aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-03-18 00:53:57 +0000
committerBill Nottingham <notting@redhat.com>1999-03-18 00:53:57 +0000
commit6aac6bb6c8ceea467a12dc5a6810d73cf516a445 (patch)
tree32723287fadf74cc93ebe809470296b6837892b9 /src
parent5fd45fcb73f4585781bbdb79112ff0812c2c2c5f (diff)
downloadinitscripts-6aac6bb6c8ceea467a12dc5a6810d73cf516a445.tar
initscripts-6aac6bb6c8ceea467a12dc5a6810d73cf516a445.tar.gz
initscripts-6aac6bb6c8ceea467a12dc5a6810d73cf516a445.tar.bz2
initscripts-6aac6bb6c8ceea467a12dc5a6810d73cf516a445.tar.xz
initscripts-6aac6bb6c8ceea467a12dc5a6810d73cf516a445.zip
gack. don't exit on command format errors from subprocess
Diffstat (limited to 'src')
-rw-r--r--src/Makefile2
-rw-r--r--src/initlog.c17
-rw-r--r--src/initlog.h2
-rw-r--r--src/process.c2
4 files changed, 12 insertions, 11 deletions
diff --git a/src/Makefile b/src/Makefile
index a93c2b48..ad7d36bc 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,4 @@
-CFLAGS+=-Wall -D_GNU_SOURCE
+CFLAGS+=-Wall -D_GNU_SOURCE -g
PROGS=usernetctl doexec netreport testd usleep ipcalc initlog minilogd loglevel
INITLOG_OBJS=initlog.o process.o
diff --git a/src/initlog.c b/src/initlog.c
index f7e0fc49..4788c8fa 100644
--- a/src/initlog.c
+++ b/src/initlog.c
@@ -189,7 +189,7 @@ int logString(char *cmd, char *string) {
return logLine(&logentry);
}
-void processArgs(int argc, char **argv) {
+int processArgs(int argc, char **argv) {
char *cmdname=NULL;
int cmdevent=0;
char *cmd=NULL;
@@ -270,26 +270,28 @@ void processArgs(int argc, char **argv) {
fprintf(stderr, "%s: %s\n",
poptBadOption(context, POPT_BADOPTION_NOALIAS),
poptStrerror(rc));
- exit(-1);
+
+ return -1;
}
if ( (cmd && logstring) || (cmd && cmdname) ) {
fprintf(stderr, _("--cmd and --run are incompatible with --string or --name\n"));
- exit(-1);
+ return -1;
}
if ( cmdname && (!logstring && !cmdevent)) {
fprintf(stderr, _("--name requires one of --event or --string\n"));
- exit(-1);
+ return -1;
}
if (cmdevent) {
logEvent(cmdname,cmdevent,logstring);
} else if (logstring) {
logString(cmdname,logstring);
} else if ( cmd ) {
- exit(runCommand(cmd,reexec,quiet));
+ return(runCommand(cmd,reexec,quiet));
} else {
fprintf(stderr,"nothing to do!\n");
- exit(-1);
+ return -1;
}
+ return 0;
}
int main(int argc, char **argv) {
@@ -297,6 +299,5 @@ int main(int argc, char **argv) {
setlocale(LC_ALL,"");
bindtextdomain("initlog","/etc/locale");
textdomain("initlog");
- processArgs(argc,argv);
- exit (0);
+ exit(processArgs(argc,argv));
}
diff --git a/src/initlog.h b/src/initlog.h
index fbcedc72..184c916c 100644
--- a/src/initlog.h
+++ b/src/initlog.h
@@ -13,6 +13,6 @@ struct logInfo {
char *getLine(char **data);
int logString(char *cmd, char *string);
-void processArgs(int argc, char **argv);
+int processArgs(int argc, char **argv);
#endif
diff --git a/src/process.c b/src/process.c
index c4b24473..548c1b67 100644
--- a/src/process.c
+++ b/src/process.c
@@ -144,7 +144,7 @@ int monitor(char *cmdname, int pid, int numfds, int *fds, int reexec, int quiet)
if (!reexec) {
if (getenv("IN_INITLOG")) {
char *buffer=calloc(2048,sizeof(char));
- snprintf(buffer,2048,"-n %s -s \"%s\"",
+ snprintf(buffer,2048,"-n %s -s \"%s\"\n",
cmdname,tmpstr);
write(CMD_FD,buffer,strlen(buffer));
free(buffer);