File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 11SHELL =bash
2- CFLAGS =-std =gnu99 -static -s -Wall -Werror -O3
2+ CFLAGS_AUTO =-std =gnu99 -static-pie -s -Wall -Werror -O3
33
44TEST_PACKAGE_DEPS := build-essential python python-pip procps python-dev python-setuptools
55
@@ -8,7 +8,7 @@ VERSION = $(shell cat VERSION)
88
99.PHONY : build
1010build : VERSION.h
11- $(CC ) $(CFLAGS ) -o dumb-init dumb-init.c
11+ $(CC ) $(CFLAGS_AUTO ) $( CFLAGS ) -o dumb-init dumb-init.c
1212
1313VERSION.h : VERSION
1414 echo ' // THIS FILE IS AUTOMATICALLY GENERATED' > VERSION.h
Original file line number Diff line number Diff line change @@ -292,9 +292,9 @@ int main(int argc, char *argv[]) {
292292 }
293293 }
294294
295- child_pid = fork ();
295+ child_pid = vfork ();
296296 if (child_pid < 0 ) {
297- PRINTERR ("Unable to fork . Exiting.\n" );
297+ PRINTERR ("Unable to vfork . Exiting.\n" );
298298 return 1 ;
299299 } else if (child_pid == 0 ) {
300300 /* child */
@@ -306,7 +306,7 @@ int main(int argc, char *argv[]) {
306306 errno ,
307307 strerror (errno )
308308 );
309- exit (1 );
309+ _exit (1 );
310310 }
311311
312312 if (ioctl (STDIN_FILENO , TIOCSCTTY , 0 ) == -1 ) {
@@ -322,7 +322,7 @@ int main(int argc, char *argv[]) {
322322
323323 // if this point is reached, exec failed, so we should exit nonzero
324324 PRINTERR ("%s: %s\n" , cmd [0 ], strerror (errno ));
325- return 2 ;
325+ _exit ( 2 ) ;
326326 } else {
327327 /* parent */
328328 DEBUG ("Child spawned with PID %d.\n" , child_pid );
@@ -337,4 +337,6 @@ int main(int argc, char *argv[]) {
337337 handle_signal (signum );
338338 }
339339 }
340+
341+ return 1 ;
340342}
You can’t perform that action at this time.
0 commit comments