From b9a389c841db8433bb3b02158b1512cf577dbff7 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 12 Oct 2014 14:54:29 +0200 Subject: [PATCH] minor fixes to michels patches Signed-off-by: John Crispin --- inittab.c | 10 +++++----- utils/utils.c | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/inittab.c b/inittab.c index 7f76a1e..0d62708 100644 --- 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; diff --git a/utils/utils.c b/utils/utils.c index 5e67310..a8c2a91 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -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; } -- 2.25.1