aboutsummaryrefslogtreecommitdiffstats
path: root/src/initlog.c
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/initlog.c
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/initlog.c')
-rw-r--r--src/initlog.c17
1 files changed, 9 insertions, 8 deletions
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));
}