chiark / gitweb /
logger: when passing on PID info, fall back to our own if originating process is...
authorLennart Poettering <lennart@poettering.net>
Thu, 6 Jan 2011 23:18:51 +0000 (00:18 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 6 Jan 2011 23:49:35 +0000 (00:49 +0100)
TODO
src/logger.c

diff --git a/TODO b/TODO
index 14685d2335377f9421938c4af07a5dc65ff76652..9acf4dd39ec1b660d0c27324c1eec65492e93541 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+* when launching pager, take number of columns first
+
 * support remote/ssh systemctl/systemadm, and local privileged access
 
 * finish syslog socket stuff
 * support remote/ssh systemctl/systemadm, and local privileged access
 
 * finish syslog socket stuff
index 32c57f8f82a6046d9e1bf1520d406b6b8a3fffa5..482ec41244502298a1b12b877367a00b37a77ece 100644 (file)
@@ -187,8 +187,28 @@ static int stream_log(Stream *s, char *p, usec_t ts) {
                 for (;;) {
                         ssize_t n;
 
                 for (;;) {
                         ssize_t n;
 
-                        if ((n = sendmsg(s->server->syslog_fd, &msghdr, MSG_NOSIGNAL)) < 0)
+                        if ((n = sendmsg(s->server->syslog_fd, &msghdr, MSG_NOSIGNAL)) < 0) {
+
+                                if (errno == ESRCH) {
+                                        pid_t our_pid;
+
+                                        /* Hmm, maybe the process this
+                                         * line originates from is
+                                         * dead? Then let's patch in
+                                         * our own pid and retry,
+                                         * since we have nothing
+                                         * better */
+
+                                        our_pid = getpid();
+
+                                        if (ucred->pid != our_pid) {
+                                                ucred->pid = our_pid;
+                                                continue;
+                                        }
+                                }
+
                                 return -errno;
                                 return -errno;
+                        }
 
                         if (!s->server->syslog_is_stream ||
                             (size_t) n >= IOVEC_TOTAL_SIZE(iovec, ELEMENTSOF(iovec)))
 
                         if (!s->server->syslog_is_stream ||
                             (size_t) n >= IOVEC_TOTAL_SIZE(iovec, ELEMENTSOF(iovec)))