hush: tighten up "for" variable name check.
[oweals/busybox.git] / miscutils / devfsd.c
index 1b88f050e85cc1d0f0d6b0181e345875970503c0..61b97dce41c53017c553f1c04eb89750c8ec7639 100644 (file)
 /*  Never change this otherwise the binary interface will change   */
 
 struct devfsd_notify_struct
-{   /*  Use native C types to ensure same types in kernel and user space     */
-    unsigned int type;           /*  DEVFSD_NOTIFY_* value                   */
-    unsigned int mode;           /*  Mode of the inode or device entry       */
-    unsigned int major;          /*  Major number of device entry            */
-    unsigned int minor;          /*  Minor number of device entry            */
-    unsigned int uid;            /*  Uid of process, inode or device entry   */
-    unsigned int gid;            /*  Gid of process, inode or device entry   */
-    unsigned int overrun_count;  /*  Number of lost events                   */
-    unsigned int namelen;        /*  Number of characters not including '\0' */
-    /*  The device name MUST come last                                       */
-    char devname[DEVFS_PATHLEN]; /*  This will be '\0' terminated            */
+{      /*  Use native C types to ensure same types in kernel and user space     */
+       unsigned int type;           /*  DEVFSD_NOTIFY_* value                   */
+       unsigned int mode;           /*  Mode of the inode or device entry       */
+       unsigned int major;          /*  Major number of device entry            */
+       unsigned int minor;          /*  Minor number of device entry            */
+       unsigned int uid;            /*  Uid of process, inode or device entry   */
+       unsigned int gid;            /*  Gid of process, inode or device entry   */
+       unsigned int overrun_count;  /*  Number of lost events                   */
+       unsigned int namelen;        /*  Number of characters not including '\0' */
+       /*  The device name MUST come last                                       */
+       char devname[DEVFS_PATHLEN]; /*  This will be '\0' terminated            */
 };
 
 #define BUFFER_SIZE 16384
@@ -283,9 +283,9 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found";
 #else
 #define info_logger(p, fmt, args...)
 #define msg_logger(p, fmt, args...)
-#define msg_logger_and_die(p, fmt, args...)           exit(1)
+#define msg_logger_and_die(p, fmt, args...)           exit(EXIT_FAILURE)
 #define error_logger(p, fmt, args...)
-#define error_logger_and_die(p, fmt, args...)         exit(1)
+#define error_logger_and_die(p, fmt, args...)         exit(EXIT_FAILURE)
 #endif
 
 static void safe_memcpy(char *dest, const char *src, int len)
@@ -402,7 +402,7 @@ int devfsd_main(int argc, char **argv)
        dir_operation(SERVICE, mount_point, 0, NULL);
 
        if (ENABLE_DEVFSD_FG_NP && no_polling)
-               exit(0);
+               exit(EXIT_SUCCESS);
 
        if (ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG)
                logmode = LOGMODE_BOTH;
@@ -459,7 +459,7 @@ static void read_config_file(char *path, int optional, unsigned long *event_mask
                        free(p);
                        return;
                }
-               fp = fopen(path, "r");
+               fp = fopen_for_read(path);
                if (fp != NULL) {
                        while (fgets(buf, STRING_LENGTH, fp) != NULL) {
                                /*  Skip whitespace  */
@@ -741,7 +741,7 @@ static void action_permissions(const struct devfsd_notify_struct *info,
 }   /*  End Function action_permissions  */
 
 static void action_modload(const struct devfsd_notify_struct *info,
-                           const struct config_entry_struct *entry ATTRIBUTE_UNUSED)
+                           const struct config_entry_struct *entry UNUSED_PARAM)
 /*  [SUMMARY] Load a module.
     <info> The devfs change.
     <entry> The config file entry.
@@ -1091,7 +1091,7 @@ static int get_uid_gid(int flag, const char *string)
                msg = "group";
 
        if (ENABLE_DEVFSD_VERBOSE)
-               msg_logger(LOG_ERR,"unknown %s: %s, defaulting to %cid=0",  msg, string, msg[0]);
+               msg_logger(LOG_ERR, "unknown %s: %s, defaulting to %cid=0",  msg, string, msg[0]);
        return 0;
 }/*  End Function get_uid_gid  */
 
@@ -1732,7 +1732,7 @@ static const char *expand_variable(char *buffer, unsigned int length,
                                --open_braces;
                                break;
                        case '\0':
-                               info_logger(LOG_INFO,"\"}\" not found in: %s", input);
+                               info_logger(LOG_INFO, "\"}\" not found in: %s", input);
                                return NULL;
                        default:
                                break;