ifconfig: code shrink
[oweals/busybox.git] / miscutils / devfsd.c
index 6b31f368a979959ec8bafe799b6e1b964bddd0cc..cd94869ae63f888b86ccb5690cfb4c5a21acbafb 100644 (file)
@@ -336,7 +336,7 @@ static unsigned int scan_dev_name(const char *d, unsigned int n, const char *ptr
 
 /*  Public functions follow  */
 
-int devfsd_main(int argc, char **argv);
+int devfsd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int devfsd_main(int argc, char **argv)
 {
        int print_version = FALSE;
@@ -371,10 +371,7 @@ int devfsd_main(int argc, char **argv)
        xchdir(mount_point);
 
        fd = xopen(".devfsd", O_RDONLY);
-
-       if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0)
-               bb_perror_msg_and_die("FD_CLOEXEC");
-
+       close_on_exec_on(fd);
        xioctl(fd, DEVFSDIOC_GET_PROTO_REV, &proto_rev);
 
        /*setup initial entries */
@@ -631,7 +628,8 @@ static void process_config_line(const char *line, unsigned long *event_mask)
                last_config->next = new;
        last_config = new;
        return;
-process_config_line_err:
+
+ process_config_line_err:
        msg_logger_and_die(LOG_ERR, bb_msg_bad_config, msg , line);
 }  /*  End Function process_config_line   */
 
@@ -644,11 +642,9 @@ static int do_servicing(int fd, unsigned long event_mask)
 {
        ssize_t bytes;
        struct devfsd_notify_struct info;
-       unsigned long tmp_event_mask;
 
-       /*  Tell devfs what events we care about  */
-       tmp_event_mask = event_mask;
-       xioctl(fd, DEVFSDIOC_SET_EVENT_MASK, tmp_event_mask);
+       /* (void*) cast is only in order to match prototype */
+       xioctl(fd, DEVFSDIOC_SET_EVENT_MASK, (void*)event_mask);
        while (!caught_signal) {
                errno = 0;
                bytes = read(fd,(char *) &info, sizeof info);