aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-06 07:17:02 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-06 07:17:02 +0000
commit278a1c22645263f1a82bb3437345e3d96c3f13eb (patch)
tree1e9f967ca896674212d8aecb17919bacbb4c1515 /libbb
parentad4da989e3767cdf4620725c16908b4f99dbe2c9 (diff)
downloadbusybox-278a1c22645263f1a82bb3437345e3d96c3f13eb.tar.gz
brctl: optional support for "show" cmd (by L. Gabriel Somlo <somlo AT cmu.edu>)
function old new delta brctl_main 739 1186 +447 if_indextoname - 104 +104 static.keywords 827 841 +14 static.ops - 7 +7 packed_usage 23978 23976 -2
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xfuncs.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index ca7f94173..125063935 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -704,17 +704,20 @@ int get_terminal_width_height(int fd, int *width, int *height)
return ret;
}
-void ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,...)
+int ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,...)
{
+ int ret;
va_list p;
- if (ioctl(fd, request, argp) < 0) {
+ ret = ioctl(fd, request, argp);
+ if (ret < 0) {
va_start(p, fmt);
bb_verror_msg(fmt, p, strerror(errno));
/* xfunc_die can actually longjmp, so be nice */
va_end(p);
xfunc_die();
}
+ return ret;
}
int ioctl_or_perror(int fd, int request, void *argp, const char *fmt,...)
@@ -740,10 +743,14 @@ int bb_ioctl_or_warn(int fd, int request, void *argp, const char *ioctl_name)
bb_simple_perror_msg(ioctl_name);
return ret;
}
-void bb_xioctl(int fd, int request, void *argp, const char *ioctl_name)
+int bb_xioctl(int fd, int request, void *argp, const char *ioctl_name)
{
- if (ioctl(fd, request, argp) < 0)
+ int ret;
+
+ ret = ioctl(fd, request, argp);
+ if (ret < 0)
bb_simple_perror_msg_and_die(ioctl_name);
+ return ret;
}
#else
int bb_ioctl_or_warn(int fd, int request, void *argp)
@@ -755,9 +762,13 @@ int bb_ioctl_or_warn(int fd, int request, void *argp)
bb_perror_msg("ioctl %#x failed", request);
return ret;
}
-void bb_xioctl(int fd, int request, void *argp)
+int bb_xioctl(int fd, int request, void *argp)
{
- if (ioctl(fd, request, argp) < 0)
+ int ret;
+
+ ret = ioctl(fd, request, argp);
+ if (ret < 0)
bb_perror_msg_and_die("ioctl %#x failed", request);
+ return ret;
}
#endif