[systemd-commits] 5 commits - src/activate src/analyze src/core src/journal src/python-systemd src/shared src/udev

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Wed Mar 20 16:20:09 PDT 2013


 src/activate/activate.c       |    8 ++++----
 src/analyze/systemd-analyze.c |    9 ++++++---
 src/core/namespace.c          |   15 +++++----------
 src/core/syscall-list.c       |    3 ++-
 src/journal/journalctl.c      |    2 +-
 src/python-systemd/id128.c    |    2 +-
 src/shared/util.c             |    1 -
 src/udev/keymap/keymap.c      |    2 +-
 8 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit 23ea3dab15181a3966ec45fa2ccbb81e59d2e0a7
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 18:30:31 2013 -0400

    activate: avoid warning from -Wshadow
    
    src/activate/activate.c:167:51: warning: declaration shadows a variable in the global scope [-Wshadow]
    static int launch(char* name, char **argv, char **environ, int fds) {
                                                      ^
    /usr/include/unistd.h:546:15: note: previous declaration is here
    extern char **environ;
                  ^

diff --git a/src/activate/activate.c b/src/activate/activate.c
index be40be4..a6e7248 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -164,7 +164,7 @@ static int open_sockets(int *epoll_fd, bool accept) {
         return count;
 }
 
-static int launch(char* name, char **argv, char **environ, int fds) {
+static int launch(char* name, char **argv, char **env, int fds) {
         unsigned n_env = 0, length;
         char **envp = NULL, **s;
         static const char* tocopy[] = {"TERM=", "PATH=", "USER=", "HOME="};
@@ -182,14 +182,14 @@ static int launch(char* name, char **argv, char **environ, int fds) {
                         char _cleanup_free_ *p = strappend(*s, "=");
                         if (!p)
                                 return log_oom();
-                        envp[n_env] = strv_find_prefix(environ, p);
+                        envp[n_env] = strv_find_prefix(env, p);
                         if (envp[n_env])
                                 n_env ++;
                 }
         }
 
         for (i = 0; i < ELEMENTSOF(tocopy); i++) {
-                envp[n_env] = strv_find_prefix(environ, tocopy[i]);
+                envp[n_env] = strv_find_prefix(env, tocopy[i]);
                 if (envp[n_env])
                         n_env ++;
         }
@@ -208,7 +208,7 @@ static int launch(char* name, char **argv, char **environ, int fds) {
         return -errno;
 }
 
-static int launch1(const char* child, char** argv, char **environ, int fd) {
+static int launch1(const char* child, char** argv, char **env, int fd) {
         pid_t parent_pid, child_pid;
         int r;
 

commit 131c01dbe9b5f71f8c913d1ebb10c926a47ac6a6
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 18:27:49 2013 -0400

    Make two functions static

diff --git a/src/core/syscall-list.c b/src/core/syscall-list.c
index b608e85..35216b2 100644
--- a/src/core/syscall-list.c
+++ b/src/core/syscall-list.c
@@ -26,7 +26,8 @@
 
 #include "syscall-list.h"
 
-const struct syscall_name *lookup_syscall(register const char *str, register unsigned int len);
+static const struct syscall_name* lookup_syscall(register const char *str,
+                                                 register unsigned int len);
 
 #include "syscall-to-name.h"
 #include "syscall-from-name.h"
diff --git a/src/udev/keymap/keymap.c b/src/udev/keymap/keymap.c
index 27aaf6b..ae0a19d 100644
--- a/src/udev/keymap/keymap.c
+++ b/src/udev/keymap/keymap.c
@@ -36,7 +36,7 @@
 #include <linux/limits.h>
 #include <linux/input.h>
 
-const struct key* lookup_key (const char *str, unsigned int len);
+static const struct key* lookup_key (const char *str, unsigned int len);
 
 #include "keys-from-name.h"
 #include "keys-to-name.h"

commit 4750fade135aed733aa7a5fda7c670e6b4391538
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 18:25:35 2013 -0400

    Remove some unused variables

diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 975c44f..ddadc21 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -596,7 +596,7 @@ static int add_this_boot(sd_journal *j) {
 }
 
 static int add_unit(sd_journal *j) {
-        _cleanup_free_ char *m = NULL, *u = NULL;
+        _cleanup_free_ char *u = NULL;
         int r;
 
         assert(j);
diff --git a/src/python-systemd/id128.c b/src/python-systemd/id128.c
index 865cc3c..a9611c4 100644
--- a/src/python-systemd/id128.c
+++ b/src/python-systemd/id128.c
@@ -54,7 +54,7 @@ PyDoc_STRVAR(get_boot__doc__,
 static PyObject* make_uuid(sd_id128_t id) {
         PyObject _cleanup_Py_DECREF_
                 *uuid = NULL, *UUID = NULL, *bytes = NULL,
-                *args = NULL, *kwargs = NULL, *obj = NULL;
+                *args = NULL, *kwargs = NULL;
 
         uuid = PyImport_ImportModule("uuid");
         if (!uuid)
diff --git a/src/shared/util.c b/src/shared/util.c
index 69f1b00..872f6f7 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5553,7 +5553,6 @@ int on_ac_power(void) {
         for (;;) {
                 struct dirent *de;
                 union dirent_storage buf;
-                _cleanup_free_ char *p = NULL;
                 _cleanup_close_ int fd = -1, device = -1;
                 char contents[6];
                 ssize_t n;

commit fd4a5ec6fa834eb299b8e0ba6ab3e348d00d61b6
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 18:22:20 2013 -0400

    systemd-analyze: do not format timestamp when not printing it
    
    ../src/analyze/systemd-analyze.c:530:88: warning: data argument not used by format string [-Wformat-extra-args]
      ...svg_text(false, u->ixt, y, u->time? "%s (%s)" : "%s", u->name, format_timespan(ts, sizeof(ts), u->time));
                                                         ~~~~           ^

diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 49484a8..01bf55e 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -518,6 +518,7 @@ static int analyze_plot(DBusConnection *bus) {
 
         for (u = times; u < times + n; u++) {
                 char ts[FORMAT_TIMESPAN_MAX];
+                bool b;
 
                 if (!u->name)
                         continue;
@@ -526,10 +527,12 @@ static int analyze_plot(DBusConnection *bus) {
                 svg_bar("active",       u->aet, u->axt, y);
                 svg_bar("deactivating", u->axt, u->iet, y);
 
-                if (u->ixt * SCALE_X > width * 2 / 3)
-                        svg_text(false, u->ixt, y, u->time? "%s (%s)" : "%s", u->name, format_timespan(ts, sizeof(ts), u->time));
+                b = u->ixt * SCALE_X > width * 2 / 3;
+                if (u->time)
+                        svg_text(b, u->ixt, y, "%s (%s)",
+                                 u->name, format_timespan(ts, sizeof(ts), u->time));
                 else
-                        svg_text(true, u->ixt, y, u->time? "%s (%s)" : "%s", u->name, format_timespan(ts, sizeof(ts), u->time));
+                        svg_text(b, u->ixt, y, "%s", u->name);
                 y++;
         }
         svg("</g>\n\n");

commit d5a3f0eac7cd28ad28fb5239b0dca14c7ba11eeb
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Wed Mar 20 18:12:37 2013 -0400

    core: remove unnecessary goto in setup_namespace

diff --git a/src/core/namespace.c b/src/core/namespace.c
index 972380a..7e33d84 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -218,16 +218,14 @@ int setup_namespace(char** read_write_dirs,
         if (!mount_flags)
                 mount_flags = MS_SHARED;
 
-        if (unshare(CLONE_NEWNS) < 0) {
-                r = -errno;
-                goto fail;
-        }
+        if (unshare(CLONE_NEWNS) < 0)
+                return -errno;
 
         m = mounts = (BindMount *) alloca(n * sizeof(BindMount));
         if ((r = append_mounts(&m, read_write_dirs, READWRITE)) < 0 ||
                 (r = append_mounts(&m, read_only_dirs, READONLY)) < 0 ||
                 (r = append_mounts(&m, inaccessible_dirs, INACCESSIBLE)) < 0)
-                goto fail;
+                return r;
 
         if (private_tmp) {
                 m->path = "/tmp";
@@ -246,10 +244,8 @@ int setup_namespace(char** read_write_dirs,
 
         /* Remount / as SLAVE so that nothing now mounted in the namespace
            shows up in the parent */
-        if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) {
-                r = -errno;
-                goto fail;
-        }
+        if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL) < 0)
+                return -errno;
 
         for (m = mounts; m < mounts + n; ++m) {
                 r = apply_mount(m, tmp_dir, var_tmp_dir);
@@ -277,6 +273,5 @@ undo_mounts:
                         umount2(m->path, MNT_DETACH);
         }
 
-fail:
         return r;
 }



More information about the systemd-commits mailing list