[systemd-commits] 2 commits - src/libudev src/shared

Tom Gundersen tomegun at kemper.freedesktop.org
Wed Apr 1 05:46:33 PDT 2015


 src/libudev/libudev-monitor.c |   10 ++++++++--
 src/shared/set.h              |    2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit e6ac88ddf213c431c678cfdac689577abbc14b28
Author: Tom Gundersen <teg at jklm.no>
Date:   Wed Apr 1 13:55:52 2015 +0200

    libudev: monitor - improve logging

diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 3925852..c48ac78 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -643,6 +643,8 @@ retry:
                         return NULL;
                 }
                 if (buf.nlh.properties_off+32 > (size_t)buflen) {
+                        log_debug("message smaller than expected (%u > %zd)",
+                                  buf.nlh.properties_off+32, buflen);
                         return NULL;
                 }
 
@@ -666,8 +668,10 @@ retry:
         }
 
         udev_device = udev_device_new_from_nulstr(udev_monitor->udev, &buf.raw[bufpos], buflen - bufpos);
-        if (!udev_device)
+        if (!udev_device) {
+                log_debug("could not create device: %m");
                 return NULL;
+        }
 
         if (is_initialized)
                 udev_device_set_is_initialized(udev_device);
@@ -712,8 +716,10 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
         uint64_t tag_bloom_bits;
 
         blen = udev_device_get_properties_monitor_buf(udev_device, &buf);
-        if (blen < 32)
+        if (blen < 32) {
+                log_debug("device buffer is too small to contain a valid device");
                 return -EINVAL;
+        }
 
         /* fill in versioned header */
         val = udev_device_get_subsystem(udev_device);

commit 4a9185c4388d866ddc7c2881e5a31ddd141493af
Author: Tom Gundersen <teg at jklm.no>
Date:   Wed Apr 1 13:46:59 2015 +0200

    shared: set - make argument to set_remove() const

diff --git a/src/shared/set.h b/src/shared/set.h
index 2b49e2f..4dffecd 100644
--- a/src/shared/set.h
+++ b/src/shared/set.h
@@ -57,7 +57,7 @@ static inline bool set_contains(Set *s, const void *key) {
         return internal_hashmap_contains(HASHMAP_BASE(s), key);
 }
 
-static inline void *set_remove(Set *s, void *key) {
+static inline void *set_remove(Set *s, const void *key) {
         return internal_hashmap_remove(HASHMAP_BASE(s), key);
 }
 



More information about the systemd-commits mailing list