diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2020-11-26 16:36:50 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2020-11-26 16:36:50 +0000 |
commit | 05952067bb67e3f627c969fd91c9fef29dc7b27e (patch) | |
tree | 8e7ff66b976cd4d96561d73bf296605d1a455a50 /sbin/ifconfig/ifclone.c | |
parent | accf961151a93d8a2248da6196a4988ecebc59b0 (diff) |
Ensure consistent error messages from ifconfig(8).
If multiple threads are invoking "ifconfig XXX create" a race may occur
which can lead to two different error messages for the same error.
a) ifconfig: SIOCIFCREATE2: File exists
b) ifconfig: interface XXX already exists
This patch ensures ifconfig prints the same error code
for the same case.
Reviewed by: imp@ and kib@
Differential Revision: https://reviews.freebsd.org/D27380
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
Notes
Notes:
svn path=/head/; revision=368058
Diffstat (limited to 'sbin/ifconfig/ifclone.c')
-rw-r--r-- | sbin/ifconfig/ifclone.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifclone.c b/sbin/ifconfig/ifclone.c index 58bc3b3103ee..268cc0a28180 100644 --- a/sbin/ifconfig/ifclone.c +++ b/sbin/ifconfig/ifclone.c @@ -151,8 +151,7 @@ ifclonecreate(int s, void *arg) } if (clone_cb == NULL) { /* NB: no parameters */ - if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) - err(1, "SIOCIFCREATE2"); + ioctl_ifcreate(s, &ifr); } else { clone_cb(s, &ifr); } |