]> git.wh0rd.org Git - patches.git/blob - busybox-xioctl.patch
scummvm random work
[patches.git] / busybox-xioctl.patch
1 Index: console-tools/deallocvt.c
2 ===================================================================
3 --- console-tools/deallocvt.c   (revision 18902)
4 +++ console-tools/deallocvt.c   (working copy)
5 @@ -31,8 +31,7 @@ int deallocvt_main(int argc, char **argv
6                 bb_show_usage();
7         }
8  
9 -       if (-1 == ioctl(get_console_fd(), VT_DISALLOCATE, num)) {
10 -               bb_perror_msg_and_die("VT_DISALLOCATE");
11 -       }
12 +       xioctl(get_console_fd(), VT_DISALLOCATE, num);
13 +
14         return EXIT_SUCCESS;
15  }
16 Index: libbb/xfuncs.c
17 ===================================================================
18 --- libbb/xfuncs.c      (revision 18902)
19 +++ libbb/xfuncs.c      (working copy)
20 @@ -639,3 +639,13 @@ int get_terminal_width_height(const int 
21  
22         return ret;
23  }
24 +
25 +/* Die if the ioctl() call failed.  Only support the 3 arg form. */
26 +#undef xioctl
27 +int xioctl(int fd, int request, unsigned long arg)
28 +{
29 +       int ret = ioctl(fd, request, arg);
30 +       if (ret != 0)
31 +               bb_perror_msg_and_die("ioctl");
32 +       return ret;
33 +}
34 Index: miscutils/raidautorun.c
35 ===================================================================
36 --- miscutils/raidautorun.c     (revision 18902)
37 +++ miscutils/raidautorun.c     (working copy)
38 @@ -19,9 +19,7 @@ int raidautorun_main(int argc, char **ar
39         if (argc != 2)
40                 bb_show_usage();
41  
42 -       if (ioctl(xopen(argv[1], O_RDONLY), RAID_AUTORUN, NULL) != 0) {
43 -               bb_perror_msg_and_die("ioctl");
44 -       }
45 +       xioctl(xopen(argv[1], O_RDONLY), RAID_AUTORUN, NULL);
46  
47         return EXIT_SUCCESS;
48  }
49 Index: include/libbb.h
50 ===================================================================
51 --- include/libbb.h     (revision 18902)
52 +++ include/libbb.h     (working copy)
53 @@ -249,7 +249,8 @@ DIR *warn_opendir(const char *path);
54  char *xrealloc_getcwd_or_warn(char *cwd);
55  char *xmalloc_readlink_or_warn(const char *path);
56  char *xmalloc_realpath(const char *path);
57 -
58 +int xioctl(int fd, int request, unsigned long arg);
59 +#define xioctl(fd,request,arg) xioctl(fd,request,(unsigned long)arg)
60  
61  //TODO: signal(sid, f) is the same? then why?
62  extern void sig_catch(int,void (*)(int));