aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2014-09-16 17:09:57 +0200
committerLukas Nykryn <lnykryn@redhat.com>2015-10-27 16:31:56 +0100
commit9ac736c72ffcbdd48a08e2bc195b05953aa4c88c (patch)
tree353421e3cdd66133cf7edd0683086eae27ec66eb /src
parenteec005d9c263a303d62c5824d2439c42a52c58ad (diff)
downloadinitscripts-9ac736c72ffcbdd48a08e2bc195b05953aa4c88c.tar
initscripts-9ac736c72ffcbdd48a08e2bc195b05953aa4c88c.tar.gz
initscripts-9ac736c72ffcbdd48a08e2bc195b05953aa4c88c.tar.bz2
initscripts-9ac736c72ffcbdd48a08e2bc195b05953aa4c88c.tar.xz
initscripts-9ac736c72ffcbdd48a08e2bc195b05953aa4c88c.zip
rename_devices: comments need to have a blank before them
Cherry-picked from: 65901ce5f29f9ec45339c3474a360d9bbcee6bac Resolves: #1220924
Diffstat (limited to 'src')
-rw-r--r--src/rename_device.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/rename_device.c b/src/rename_device.c
index f8cfd391..2f0d8de9 100644
--- a/src/rename_device.c
+++ b/src/rename_device.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <ctype.h>
#include <sys/ioctl.h>
#include <sys/time.h>
@@ -120,13 +121,19 @@ int isCfg(const struct dirent *dent) {
}
static inline char *dequote(char *start, char *end) {
- char *c;
- //remove comments and trailing whitespace
- c = strchr(start, '#');
- if (c!=NULL)
- *c='\0';
+ char *c;
+ //remove comments and trailing whitespace
+ for (c = start; c && *c; c++) {
+ c = strchr(c, '#');
+ if (!c)
+ break;
+ if (c > start && isblank(*(c-1))) {
+ *c = '\0';
+ break;
+ }
+ }
- g_strchomp(start);
+ g_strchomp(start);
if (end==NULL) {
end=start;