summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-05-24 17:43:45 +0200
committerFelix Fietkau <nbd@openwrt.org>2014-05-24 17:43:45 +0200
commit8f4162f82af7186a49bc697a43b549b7e3146385 (patch)
treef5344b79d8248cf77dfa3df6a57161ae2347dfc0
parent5735eda87465c1f800aa1a66cd47d28f02d3e1a3 (diff)
downloadunitd-8f4162f82af7186a49bc697a43b549b7e3146385.tar
unitd-8f4162f82af7186a49bc697a43b549b7e3146385.zip
inittab: strip trailing whitespace (especially newline)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--inittab.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/inittab.c b/inittab.c
index a9c3535..677ec47 100644
--- a/inittab.c
+++ b/inittab.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <regex.h>
+#include <ctype.h>
#include <libubox/utils.h>
#include <libubox/list.h>
@@ -258,6 +259,11 @@ void procd_inittab(void)
char *tags[TAG_PROCESS + 1];
char *tok;
int i;
+ int len = strlen(line);
+
+ while (isspace(line[len - 1]))
+ len--;
+ line[len] = 0;
if (*line == '#')
continue;