aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2001-03-30 17:20:41 +0000
committerBill Nottingham <notting@redhat.com>2001-03-30 17:20:41 +0000
commit9d510f46b9d0e39e548950738100fb6b6318883b (patch)
treefd8c0fb8b62733b3545711c001783def13402771
parente3525a23b67a60c0b48b9d9f3599f041512aca7e (diff)
downloadinitscripts-9d510f46b9d0e39e548950738100fb6b6318883b.tar
initscripts-9d510f46b9d0e39e548950738100fb6b6318883b.tar.gz
initscripts-9d510f46b9d0e39e548950738100fb6b6318883b.tar.bz2
initscripts-9d510f46b9d0e39e548950738100fb6b6318883b.tar.xz
initscripts-9d510f46b9d0e39e548950738100fb6b6318883b.zip
don't close the magic file descriptor
fix segfaults in popt when called with bogus stuff (#28140)
-rw-r--r--src/initlog.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/initlog.c b/src/initlog.c
index 32863591..5905e16c 100644
--- a/src/initlog.c
+++ b/src/initlog.c
@@ -1,4 +1,5 @@
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <libintl.h>
@@ -179,6 +180,7 @@ int startDaemon() {
dup2(fd,0);
dup2(fd,1);
dup2(fd,2);
+ close(fd);
/* kid */
execlp("minilogd","minilogd",NULL);
perror("exec");
@@ -416,13 +418,16 @@ int processArgs(int argc, char **argv, int silent) {
} else {
readConfiguration("/etc/initlog.conf");
}
+ if (cmd) {
+ while (isspace(*cmd)) cmd++;
+ }
if (lpri!=-1) logpriority=lpri;
if (lfac!=-1) logfacility=lfac;
if (cmdevent) {
logEvent(cmdname,cmdevent,logstring);
} else if (logstring) {
logString(cmdname,logstring);
- } else if ( cmd ) {
+ } else if ( cmd && *cmd) {
return(runCommand(cmd,reexec,quiet,debug));
} else {
if (!silent)