[systemd-commits] 3 commits - Makefile.am src/udev

David Herrmann dvdhrm at kemper.freedesktop.org
Wed Nov 5 03:58:19 PST 2014


 Makefile.am      |    1 +
 src/udev/udevd.c |   24 ++++++++++++------------
 2 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit cfe2061add5479710f6597899d632e64c54e62ef
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Wed Nov 5 12:56:49 2014 +0100

    udev: avoid magic constants in kernel-cmdline parsers
    
    Lets recognize the fact that startswith() returns a pointer to the tail on
    success. Use it instead of hard-coding string-lengths as magic constants.

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 193702c..65d086e 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -967,7 +967,7 @@ static void kernel_cmdline_options(struct udev *udev) {
                 return;
 
         FOREACH_WORD_QUOTED(word, l, line, state) {
-                char *s, *opt;
+                char *s, *opt, *value;
 
                 s = strndup(word, l);
                 if (!s)
@@ -979,24 +979,24 @@ static void kernel_cmdline_options(struct udev *udev) {
                 else
                         opt = s;
 
-                if (startswith(opt, "udev.log-priority=")) {
+                if ((value = startswith(opt, "udev.log-priority="))) {
                         int prio;
 
-                        prio = util_log_priority(opt + 18);
+                        prio = util_log_priority(value);
                         log_set_max_level(prio);
                         udev_set_log_priority(udev, prio);
-                } else if (startswith(opt, "udev.children-max=")) {
-                        r = safe_atoi(opt + 18, &arg_children_max);
+                } else if ((value = startswith(opt, "udev.children-max="))) {
+                        r = safe_atoi(value, &arg_children_max);
                         if (r < 0)
-                                log_warning("Invalid udev.children-max ignored: %s", opt + 18);
-                } else if (startswith(opt, "udev.exec-delay=")) {
-                        r = safe_atoi(opt + 16, &arg_exec_delay);
+                                log_warning("Invalid udev.children-max ignored: %s", value);
+                } else if ((value = startswith(opt, "udev.exec-delay="))) {
+                        r = safe_atoi(value, &arg_exec_delay);
                         if (r < 0)
-                                log_warning("Invalid udev.exec-delay ignored: %s", opt + 16);
-                } else if (startswith(opt, "udev.event-timeout=")) {
-                        r = safe_atou64(opt + 19, &arg_event_timeout_usec);
+                                log_warning("Invalid udev.exec-delay ignored: %s", value);
+                } else if ((value = startswith(opt, "udev.event-timeout="))) {
+                        r = safe_atou64(value, &arg_event_timeout_usec);
                         if (r < 0) {
-                                log_warning("Invalid udev.event-timeout ignored: %s", opt + 19);
+                                log_warning("Invalid udev.event-timeout ignored: %s", value);
                                 break;
                         }
                         arg_event_timeout_usec *= USEC_PER_SEC;

commit f671774f52838d35d78e62ddcb781b5b65b3373f
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Tue Nov 4 23:45:15 2014 +0000

    udev: Fix parsing of udev.event-timeout kernel parameter.

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 2e6c713..193702c 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -994,9 +994,9 @@ static void kernel_cmdline_options(struct udev *udev) {
                         if (r < 0)
                                 log_warning("Invalid udev.exec-delay ignored: %s", opt + 16);
                 } else if (startswith(opt, "udev.event-timeout=")) {
-                        r = safe_atou64(opt + 16, &arg_event_timeout_usec);
+                        r = safe_atou64(opt + 19, &arg_event_timeout_usec);
                         if (r < 0) {
-                                log_warning("Invalid udev.event-timeout ignored: %s", opt + 16);
+                                log_warning("Invalid udev.event-timeout ignored: %s", opt + 19);
                                 break;
                         }
                         arg_event_timeout_usec *= USEC_PER_SEC;

commit 01acf6c3b7390e8c47b7a5cd7cae4bcbd2846634
Author: Cristian Rodríguez <crrodriguez at opensuse.org>
Date:   Tue Nov 4 20:48:08 2014 -0300

    buildsys: test-util needs -lm for fabs()

diff --git a/Makefile.am b/Makefile.am
index ff5f61b..3686103 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1543,6 +1543,7 @@ test_util_SOURCES = \
 	src/test/test-util.c
 
 test_util_LDADD = \
+	-lm \
 	libsystemd-core.la
 
 test_uid_range_SOURCES = \



More information about the systemd-commits mailing list