- patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it.
Also use shorter boilerplate while at it.
diff --git a/networking/vconfig.c b/networking/vconfig.c
index 36458f7..72729c7 100644
--- a/networking/vconfig.c
+++ b/networking/vconfig.c
@@ -4,20 +4,7 @@
*
* Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 N/A */
@@ -136,9 +123,7 @@
}
/* Don't bother closing the filedes. It will be closed on cleanup. */
- if (open(conf_file_name, O_RDONLY) < 0) { /* Is 802.1q is present? */
- bb_perror_msg_and_die("open %s", conf_file_name);
- }
+ bb_xopen(conf_file_name, O_RDONLY); /* Will die if 802.1q is not present */
memset(&ifr, 0, sizeof(struct vlan_ioctl_args));
@@ -173,10 +158,9 @@
}
}
- if (((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- || (ioctl(fd, SIOCSIFVLAN, &ifr) < 0)
- ) {
- bb_perror_msg_and_die("socket or ioctl error for %s", *argv);
+ fd = bb_xsocket(AF_INET, SOCK_STREAM, 0);
+ if (ioctl(fd, SIOCSIFVLAN, &ifr) < 0) {
+ bb_perror_msg_and_die("ioctl error for %s", *argv);
}
return 0;