diff options
author | Lukas Nykryn <lnykryn@redhat.com> | 2014-09-16 17:09:57 +0200 |
---|---|---|
committer | Lukas Nykryn <lnykryn@redhat.com> | 2014-09-16 17:11:20 +0200 |
commit | 7b4971bc90b9766b1f643ab5c1aba7d7b3ac5fb0 (patch) | |
tree | 9a24297613a22a02a4cc7938f45fc4eb6ff030c5 | |
parent | 84f685381ee3d9b076b4948464f4c9293a24c267 (diff) | |
download | initscripts-7b4971bc90b9766b1f643ab5c1aba7d7b3ac5fb0.tar initscripts-7b4971bc90b9766b1f643ab5c1aba7d7b3ac5fb0.tar.gz initscripts-7b4971bc90b9766b1f643ab5c1aba7d7b3ac5fb0.tar.bz2 initscripts-7b4971bc90b9766b1f643ab5c1aba7d7b3ac5fb0.tar.xz initscripts-7b4971bc90b9766b1f643ab5c1aba7d7b3ac5fb0.zip |
rename_devices: comments need to have a blank before them
-rw-r--r-- | src/rename_device.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/rename_device.c b/src/rename_device.c index bb5e6b8f..f45e996c 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; |