From c45ffd7f30263049d6316034119682fd89cedff7 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 31 Mar 2005 20:52:04 +0000 Subject: bring back initlog for third-party scripts. officially deprecate it --- initscripts.spec | 8 +++++++- src/Makefile | 9 ++++++++- src/initlog.1 | 3 +++ src/initlog.c | 37 ++----------------------------------- 4 files changed, 20 insertions(+), 37 deletions(-) diff --git a/initscripts.spec b/initscripts.spec index 5c0384d8..ff6ec748 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -1,6 +1,6 @@ Summary: The inittab file and the /etc/init.d scripts. Name: initscripts -Version: 8.06 +Version: 8.07 License: GPL Group: System Environment/Base Release: 1 @@ -190,6 +190,7 @@ rm -rf $RPM_BUILD_ROOT /sbin/getkey /sbin/kmodule %attr(2755,root,root) /sbin/netreport +/sbin/initlog /sbin/service /sbin/ppp-watch %{_mandir}/man*/* @@ -202,11 +203,16 @@ rm -rf $RPM_BUILD_ROOT %config /etc/ppp/ip-down.ipv6to4 %config /etc/ppp/ipv6-up %config /etc/ppp/ipv6-down +%config /etc/initlog.conf %doc sysconfig.txt sysvinitfiles ChangeLog static-routes-ipv6 ipv6-tunnel.howto ipv6-6to4.howto changes.ipv6 %ghost %attr(0664,root,utmp) /var/log/wtmp %ghost %attr(0664,root,utmp) /var/run/utmp %changelog +* Thu Mar 31 2005 Bill Nottingham 8.07-1 +- bring back initlog for third-party scripts until a new framework is + in place + * Wed Mar 30 2005 Bill Nottingham 8.06-1 - handle alternate VLAN naming schemes (#115001, ) - ifup-ipsec: handle non-ascii keys (#150552) 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)); } -- cgit v1.2.1