commit cd01e2bd37d3b4f72caecf7dc65e4b2eee01c110
parent 06aa26ce6594e8072c300fe94c0867019d289ea5
Author: leitner <leitner>
Date: Thu, 30 Aug 2001 20:15:54 +0000
add "log" subdirectory (see README).
get rid of stdio and *printf and switch to routines from libowfat.
Diffstat:
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -1,3 +1,7 @@
+0.5:
+ add "log" subdirectory (see README).
+ get rid of stdio and *printf and switch to routines from libowfat.
+
0.4:
add pidfilehack. It will take the first argument as filename for the
PID file (i.e. /var/run/sshd.pid), the second argument as service name
diff --git a/README b/README
@@ -37,3 +37,11 @@ Each service directory can contain the following files/symlinks:
mutually exclusive with respawn. This is meant for static
initializations like "ifconfig".
+ log
+
+ if this directory exists, it is taken as service and minit creates
+ a pipe between stdout of this service and stdin of the log service.
+ If the log service can not be started, this service will block if it
+ writes to stdout. File descriptors will be reused, i.e. if the log
+ process dies and is restarted, no log entries will be lost and there
+ will be no SIGPIPE.
diff --git a/minit.c b/minit.c
@@ -293,6 +293,10 @@ void sigchild(int whatever) { dowait=1; }
void sigwinch(int sig) { dowinch=1; }
void sigint(int sig) { doint=1; }
+static void _puts(const char* s) {
+ write(1,s,strlen(s));
+}
+
main(int argc, char *argv[]) {
/* Schritt 1: argv[1] als Service nehmen und starten */
int count=0;
@@ -319,7 +323,7 @@ main(int argc, char *argv[]) {
signal(SIGINT,sigint); /* Ctrl-Alt-Del */
signal(SIGCHLD,sigchild);
if (infd<0 || outfd<0) {
- puts("minit: could not open /etc/minit/in or /etc/minit/out\n");
+ _puts("minit: could not open /etc/minit/in or /etc/minit/out\n");
nfds=0;
} else
pfd.fd=infd;
@@ -353,7 +357,7 @@ main(int argc, char *argv[]) {
childhandler();
break;
}
- puts("poll failed!\n");
+ _puts("poll failed!\n");
sulogin();
/* what should we do if poll fails?! */
break;