[systemd-commits] 4 commits - Makefile.am src/execute.c src/logger.c src/service.c src/test-strv.c src/util.c TODO

Lennart Poettering lennart at kemper.freedesktop.org
Thu Jan 6 15:49:44 PST 2011


 Makefile.am     |    4 +++-
 TODO            |   14 ++++++++------
 src/execute.c   |    3 +++
 src/logger.c    |   22 +++++++++++++++++++++-
 src/service.c   |   17 ++++++++++++-----
 src/test-strv.c |   12 ++++++++++++
 src/util.c      |    3 +++
 7 files changed, 62 insertions(+), 13 deletions(-)

New commits:
commit 2d011a7923a35d8aef49059c2e9010bf1d6a4bac
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jan 7 00:18:51 2011 +0100

    logger: when passing on PID info, fall back to our own if originating process is already gone

diff --git a/TODO b/TODO
index 14685d2..9acf4dd 100644
--- 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
diff --git a/src/logger.c b/src/logger.c
index 32c57f8..482ec41 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -187,8 +187,28 @@ static int stream_log(Stream *s, char *p, usec_t ts) {
                 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;
+                        }
 
                         if (!s->server->syslog_is_stream ||
                             (size_t) n >= IOVEC_TOTAL_SIZE(iovec, ELEMENTSOF(iovec)))

commit e83c7c0ba480c6d37d6d586b9337b1ad32ee52ca
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jan 6 23:52:58 2011 +0100

    service: don't hit an assert if information in LSB headers is incorrectly formatted
    
    https://bugzilla.redhat.com/show_bug.cgi?id=667665

diff --git a/src/service.c b/src/service.c
index 9f2ee41..a28eb8a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -328,10 +328,13 @@ static int sysv_translate_facility(const char *name, const char *filename, char
         /* If we don't know this name, fallback heuristics to figure
          * out whether something is a target or a service alias. */
 
-        if (*name == '$')
+        if (*name == '$') {
+                if (!unit_prefix_is_valid(n))
+                        return -EINVAL;
+
                 /* Facilities starting with $ are most likely targets */
                 r = unit_name_build(n, NULL, ".target");
-        else if (filename && streq(name, filename))
+        } else if (filename && streq(name, filename))
                 /* Names equalling the file name of the services are redundant */
                 return 0;
         else
@@ -684,10 +687,14 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                         }
 
                                         r = sysv_translate_facility(n, file_name_from_path(path), &m);
-                                        free(n);
 
-                                        if (r < 0)
-                                                goto finish;
+                                        if (r < 0) {
+                                                log_error("[%s:%u] Failed to translate LSB dependency %s, ignoring: %s", path, line, n, strerror(-r));
+                                                free(n);
+                                                continue;
+                                        }
+
+                                        free(n);
 
                                         if (r == 0)
                                                 continue;

commit 86a3475bc5087da2a28015247ff18672905044f4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jan 6 23:52:17 2011 +0100

    execute,util: fix two small memory leaks

diff --git a/src/execute.c b/src/execute.c
index 8f486e2..1e8dfaf 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1406,6 +1406,9 @@ void exec_context_done(ExecContext *c) {
 
         if (c->cpuset)
                 CPU_FREE(c->cpuset);
+
+        free(c->utmp_id);
+        c->utmp_id = NULL;
 }
 
 void exec_command_done(ExecCommand *c) {
diff --git a/src/util.c b/src/util.c
index aa1f19e..67a75c5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3090,6 +3090,9 @@ void status_welcome(void) {
         status_printf("Welcome to \x1B[%sm%s\x1B[0m!\n",
                       const_color ? const_color : ansi_color,
                       const_pretty ? const_pretty : pretty_name);
+
+        free(ansi_color);
+        free(pretty_name);
 }
 
 char *replace_env(const char *format, char **env) {

commit 2c4b304e64ca674e1a79a7e5c83a996a03611a17
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jan 6 23:51:52 2011 +0100

    specifier: at minimal test

diff --git a/Makefile.am b/Makefile.am
index fa704ae..3c10167 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -632,7 +632,9 @@ test_env_replace_LDADD = \
 	libsystemd-basic.la
 
 test_strv_SOURCES = \
-	src/test-strv.c
+	src/test-strv.c \
+	src/specifier.c \
+	src/specifier.h
 
 test_strv_CFLAGS = \
 	$(AM_CFLAGS)
diff --git a/TODO b/TODO
index 2262523..14685d2 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,9 @@
+* support remote/ssh systemctl/systemadm, and local privileged access
+
+* finish syslog socket stuff
+
+* when starting systemd --user we get "Failed to set udev event buffer size."
+
 * configurable jitter for timer events
 
 * dbus should run with oom adjust set
@@ -5,18 +11,12 @@
 * support caching password questions in plymouth and on the console
   https://bugzilla.redhat.com/show_bug.cgi?id=655538
 
-* make it possible to disable hwclock-save.service
-  https://bugzilla.redhat.com/show_bug.cgi?id=297421
-
 * dep loop when using encrypted swap
   https://bugzilla.redhat.com/show_bug.cgi?id=657234
 
 * exclude java hsp files by default
   https://bugzilla.redhat.com/show_bug.cgi?id=527425
 
-* make failing dm detaching in systemd-shutdown less noisy
-  https://bugzilla.redhat.com/show_bug.cgi?id=657497
-
 * load EnvironmentFile= when starting services, not when reloading configuration
   https://bugzilla.redhat.com/show_bug.cgi?id=661282
 
diff --git a/src/test-strv.c b/src/test-strv.c
index cfbf7fd..1d577df 100644
--- a/src/test-strv.c
+++ b/src/test-strv.c
@@ -20,9 +20,17 @@
 ***/
 
 #include <string.h>
+
 #include "util.h"
+#include "specifier.h"
 
 int main(int argc, char *argv[]) {
+        const Specifier table[] = {
+                { 'a', specifier_string, (char*) "AAAA" },
+                { 'b', specifier_string, (char*) "BBBB" },
+                { 0, NULL, NULL }
+        };
+
         char *w, *state;
         size_t l;
         const char test[] = "test a b c 'd' e '' '' hhh '' ''";
@@ -50,5 +58,9 @@ int main(int argc, char *argv[]) {
         printf("%s\n", default_term_for_tty("pts/0"));
         printf("%s\n", default_term_for_tty("console"));
 
+        w = specifier_printf("xxx a=%a b=%b yyy", table, NULL);
+        printf("<%s>\n", w);
+        free(w);
+
         return 0;
 }



More information about the systemd-commits mailing list