aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Lécureuil <neoclust@mageia.org>2016-02-12 13:41:11 +0100
committerNicolas Lécureuil <neoclust@mageia.org>2016-02-12 13:41:11 +0100
commitb91d741cab5facd8f2bb87b2d6a1d172459ae606 (patch)
treea0f1d55f9a2f61a22a9d590a05877dc885340eac /src
parent052f95ee56dcc8cb8e815b7dadb2056caf484128 (diff)
parent3cc6e647008a06a13fac1e0c8885807a1e0b661b (diff)
downloadinitscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.tar
initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.tar.gz
initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.tar.bz2
initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.tar.xz
initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.zip
Merge tag 'initscripts-9.56-1' into distro/mga
Tag as initscripts-9.56-1
Diffstat (limited to 'src')
-rw-r--r--src/Makefile14
-rw-r--r--src/rename_device.c19
2 files changed, 20 insertions, 13 deletions
diff --git a/src/Makefile b/src/Makefile
index 7875abc5..aa9daa24 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,5 +1,5 @@
-CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE
-LDFLAGS+=$(RPM_LD_FLAGS)
+CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE -fPIE
+LDFLAGS+=$(RPM_LD_FLAGS) -pie -z relro -z now
PROGS=usernetctl netreport usleep ipcalc \
consoletype genhostid rename_device
@@ -43,20 +43,20 @@ usleep: $(USLEEP_OBJS)
$(CC) $(LDFLAGS) -o $@ $(USLEEP_OBJS) -lpopt
usernetctl.o: usernetctl.c
- $(CC) $(CFLAGS) -fPIE -c usernetctl.c -o usernetctl.o
+ $(CC) $(CFLAGS) -c usernetctl.c -o usernetctl.o
usernetctl: usernetctl.c usernetctl.o
- $(CC) $(LDFLAGS) -pie -z relro -z now -o $@ $@.o
+ $(CC) $(LDFLAGS) -o $@ $@.o
netreport.o: netreport.c
- $(CC) $(CFLAGS) -fPIE -c netreport.c -o netreport.o
+ $(CC) $(CFLAGS) -c netreport.c -o netreport.o
netreport: netreport.o
- $(CC) $(LDFLAGS) -pie -z relro -z now -o $@ $@.o
+ $(CC) $(LDFLAGS) -o $@ $@.o
shvar.o: shvar.c
$(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c shvar.c -o shvar.o
rename_device: rename_device.c
- $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -o $@ $< `pkg-config glib-2.0 --libs`
+ $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -o $@ $< $(LDFLAGS) `pkg-config glib-2.0 --libs`
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;