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-w32-278a1c22645263f1a82bb3437345e3d96c3f13eb.tar.gz
busybox-w32-278a1c22645263f1a82bb3437345e3d96c3f13eb.tar.bz2
busybox-w32-278a1c22645263f1a82bb3437345e3d96c3f13eb.zip
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)
704 return ret; 704 return ret;
705} 705}
706 706
707void ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,...) 707int ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,...)
708{ 708{
709 int ret;
709 va_list p; 710 va_list p;
710 711
711 if (ioctl(fd, request, argp) < 0) { 712 ret = ioctl(fd, request, argp);
713 if (ret < 0) {
712 va_start(p, fmt); 714 va_start(p, fmt);
713 bb_verror_msg(fmt, p, strerror(errno)); 715 bb_verror_msg(fmt, p, strerror(errno));
714 /* xfunc_die can actually longjmp, so be nice */ 716 /* xfunc_die can actually longjmp, so be nice */
715 va_end(p); 717 va_end(p);
716 xfunc_die(); 718 xfunc_die();
717 } 719 }
720 return ret;
718} 721}
719 722
720int ioctl_or_perror(int fd, int request, void *argp, const char *fmt,...) 723int 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)
740 bb_simple_perror_msg(ioctl_name); 743 bb_simple_perror_msg(ioctl_name);
741 return ret; 744 return ret;
742} 745}
743void bb_xioctl(int fd, int request, void *argp, const char *ioctl_name) 746int bb_xioctl(int fd, int request, void *argp, const char *ioctl_name)
744{ 747{
745 if (ioctl(fd, request, argp) < 0) 748 int ret;
749
750 ret = ioctl(fd, request, argp);
751 if (ret < 0)
746 bb_simple_perror_msg_and_die(ioctl_name); 752 bb_simple_perror_msg_and_die(ioctl_name);
753 return ret;
747} 754}
748#else 755#else
749int bb_ioctl_or_warn(int fd, int request, void *argp) 756int 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)
755 bb_perror_msg("ioctl %#x failed", request); 762 bb_perror_msg("ioctl %#x failed", request);
756 return ret; 763 return ret;
757} 764}
758void bb_xioctl(int fd, int request, void *argp) 765int bb_xioctl(int fd, int request, void *argp)
759{ 766{
760 if (ioctl(fd, request, argp) < 0) 767 int ret;
768
769 ret = ioctl(fd, request, argp);
770 if (ret < 0)
761 bb_perror_msg_and_die("ioctl %#x failed", request); 771 bb_perror_msg_and_die("ioctl %#x failed", request);
772 return ret;
762} 773}
763#endif 774#endif