minor fixes to michels patches
authorJohn Crispin <blogic@openwrt.org>
Sun, 12 Oct 2014 12:54:29 +0000 (14:54 +0200)
committerJohn Crispin <blogic@openwrt.org>
Sun, 12 Oct 2014 13:01:47 +0000 (15:01 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
inittab.c
utils/utils.c

index 7f76a1ecb4de0d835f55cf076917e97b275f7766..0d62708f243a247270e9253475cb7332621918ed 100644 (file)
--- a/inittab.c
+++ b/inittab.c
@@ -85,7 +85,7 @@ static int dev_exist(const char *dev)
        if (res != -1) {
                close(res);
        }
-       
+
        return (res != -1);
 }
 
@@ -172,10 +172,10 @@ static void askconsole(struct init_action *a)
        int i;
 
        tty = get_cmdline_val("console", line, sizeof(line));
-       split=strchr(tty, ',');
-       if (split != NULL)
-               split = '\0';
-       
+       split = strchr(tty, ',');
+       if (split)
+               *split = '\0';
+
        if (!dev_exist(tty)) {
                DEBUG(4, "skipping %s\n", tty);
                return;
index 5e67310528f73b2f445ec015464dbcb878a12dee..a8c2a91e7bbab14eba0a01de1c27c286a19d998c 100644 (file)
@@ -149,16 +149,16 @@ char* get_cmdline_val(const char* name, char* out, int len)
        close(fd);
 
        sprintf( pattern, "%s=([^ \n]*)", name);
-    regcomp(&pat_cmdline, pattern, REG_EXTENDED);
-    if (!regexec(&pat_cmdline, line, 2, matches, 0)) {
-       line[matches[1].rm_eo] = '\0';
+       regcomp(&pat_cmdline, pattern, REG_EXTENDED);
+       if (!regexec(&pat_cmdline, line, 2, matches, 0)) {
+               line[matches[1].rm_eo] = '\0';
                tty = (line + matches[1].rm_so);
                strncpy(out, tty, len);
                tty[len-1] = '\0';
                res = out;
        }
 
-    regfree(&pat_cmdline);
+       regfree(&pat_cmdline);
 
        return res;
 }