OSDN Git Service

qemu-ga: prefer pstrcpy: consistently NUL-terminate ifreq.ifr_name
authorJim Meyering <meyering@redhat.com>
Thu, 4 Oct 2012 11:09:58 +0000 (13:09 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 5 Oct 2012 12:58:37 +0000 (07:58 -0500)
commit1ab516ed9b6ba00bafc5ca37604f8af4680323ca
tree9063a855e9145c078cf2056c96a33167fc8be086
parent9d055d8ac83cfd590263e8862ff683f705dfdf56
qemu-ga: prefer pstrcpy: consistently NUL-terminate ifreq.ifr_name

NUL-termination of the .ifr_name field is not required, but is fine
(and preferable to using strncpy and leaving the reader to wonder),
since the first thing the linux kernel does is to clear the last byte.
Besides, using pstrcpy here makes this setting of ifr_name consistent
with the other code (e.g., net/tap-linux.c) that does the same thing.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qga/commands-posix.c