aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2005-03-31 20:52:04 +0000
committerBill Nottingham <notting@redhat.com>2005-03-31 20:52:04 +0000
commitc45ffd7f30263049d6316034119682fd89cedff7 (patch)
treeb5768278fe6a5ac812b173875164053e4bcf911e /src
parented25c43e6789cef946d56db177bfdad1a450c587 (diff)
downloadinitscripts-c45ffd7f30263049d6316034119682fd89cedff7.tar
initscripts-c45ffd7f30263049d6316034119682fd89cedff7.tar.gz
initscripts-c45ffd7f30263049d6316034119682fd89cedff7.tar.bz2
initscripts-c45ffd7f30263049d6316034119682fd89cedff7.tar.xz
initscripts-c45ffd7f30263049d6316034119682fd89cedff7.zip
bring back initlog for third-party scripts. officially deprecate it
Diffstat (limited to 'src')
-rw-r--r--src/Makefile9
-rw-r--r--src/initlog.13
-rw-r--r--src/initlog.c37
3 files changed, 13 insertions, 36 deletions
diff --git a/src/Makefile b/src/Makefile
index 3de4df1f..9ef54794 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,8 +1,9 @@
CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE
-PROGS=usernetctl doexec netreport testd usleep ipcalc \
+PROGS=usernetctl doexec netreport testd usleep ipcalc initlog \
getkey ppp-watch consoletype genhostid kmodule
PPPWATCH_OBJS=ppp-watch.o shvar.o
+INITLOG_OBJS=initlog.o process.o
USLEEP_OBJS=usleep.o
mandir=/usr/share/man
@@ -21,9 +22,11 @@ install:
install -m 2755 netreport $(ROOT)/sbin/netreport
install -m 755 ipcalc $(ROOT)/bin/ipcalc
install -m 755 genhostid $(ROOT)/sbin/genhostid
+ install -m 755 initlog $(ROOT)/sbin/initlog
install -m 755 getkey $(ROOT)/sbin/getkey
install -m 755 ppp-watch $(ROOT)/sbin/ppp-watch
install -m 755 consoletype $(ROOT)/sbin/consoletype
+ install -m 644 initlog.1 $(ROOT)$(mandir)/man1
install -m 644 genhostid.1 $(ROOT)$(mandir)/man1
install -m 644 doexec.1 $(ROOT)$(mandir)/man1
install -m 644 netreport.1 $(ROOT)$(mandir)/man1
@@ -32,6 +35,7 @@ install:
install -m 644 ppp-watch.8 $(ROOT)$(mandir)/man8
install -m 644 ipcalc.1 $(ROOT)$(mandir)/man1
install -m 644 consoletype.1 $(ROOT)$(mandir)/man1
+ install -m 644 initlog.conf $(ROOT)/etc
# this daemon and initscript are useful for testing the up/down/status stuff
# not installed by default, only comes from sources.
@@ -45,6 +49,9 @@ getkey: getkey.o
ipcalc: ipcalc.o
$(CC) $(LDFLAGS) -o $@ $< -Wl,-Bstatic -lpopt -Wl,-Bdynamic
+initlog: $(INITLOG_OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(INITLOG_OBJS) -Wl,-Bstatic -lpopt -Wl,-Bdynamic
+
usleep: $(USLEEP_OBJS)
$(CC) $(LDFLAGS) -o $@ $(USLEEP_OBJS) -Wl,-Bstatic -lpopt -Wl,-Bdynamic
diff --git a/src/initlog.1 b/src/initlog.1
index 1eb0587b..dc21a0ed 100644
--- a/src/initlog.1
+++ b/src/initlog.1
@@ -26,6 +26,9 @@ Messages that match the regular expression will not be logged.
.TP
initlog behavior can also be configured by command-line options.
+\fBNote that initlog is deprecated and will be removed in a future
+release.\fr
+
.SS OPTIONS
.TP
.I "\-c, \-\-cmd=[program]"
diff --git a/src/initlog.c b/src/initlog.c
index 3b1cded6..ccf6375b 100644
--- a/src/initlog.c
+++ b/src/initlog.c
@@ -168,38 +168,6 @@ char **toArray(char *line, int *num) {
return lines;
}
-int startDaemon() {
- int pid;
- int rc;
-
- if ( (pid = fork()) == -1 ) {
- perror("fork");
- return -1;
- }
- if ( pid ) {
- /* parent */
- waitpid(pid,&rc,0);
- if (WIFEXITED(rc)) {
- DDEBUG("minilogd returned %d!\n",WEXITSTATUS(rc));
- return WEXITSTATUS(rc);
- }
- else
- return -1;
- } else {
- int fd;
-
- fd=open("/dev/null",O_RDWR);
- dup2(fd,0);
- dup2(fd,1);
- dup2(fd,2);
- close(fd);
- /* kid */
- execlp("minilogd","minilogd",NULL);
- perror("exec");
- exit(-1);
- }
-}
-
int trySocket() {
int s;
struct sockaddr_un addr;
@@ -243,9 +211,7 @@ int logLine(struct logInfo *logEnt) {
if (!logEnt->line || !strcmp(logEnt->line,"\n")) return 0;
- if ( ((stat(_PATH_LOG,&statbuf)==-1) || trySocket())
- && startDaemon()
- ) {
+ if ((stat(_PATH_LOG,&statbuf)==-1) || trySocket()) {
DDEBUG("starting daemon failed, pooling entry %d\n",logEntries);
logData=realloc(logData,(logEntries+1)*sizeof(struct logInfo));
logData[logEntries]= (*logEnt);
@@ -461,5 +427,6 @@ int main(int argc, char **argv) {
setlocale(LC_ALL,"");
bindtextdomain("initlog","/etc/locale");
textdomain("initlog");
+ fprintf(stderr, _("WARNING: initlog is deprecated and will be removed in a future release\n"));
exit(processArgs(argc,argv,0));
}