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

Lennart Poettering lennart at kemper.freedesktop.org
Tue Dec 10 10:54:08 PST 2013


 src/core/device.c |   10 ----------
 src/shared/util.c |   13 ++++++++++++-
 2 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit ecad10fe4a4c247da72cafbc7b37f843c7c30c06
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Dec 10 18:53:08 2013 +0000

    Revert "systemd: add a start job for all units in SYSTEMD_[USER_]WANTS="
    
    This reverts commit e775289d56ace2f8d23e62ed79316d71332d6d05.
    
    We really should let the dependency logic add jobs for dependencies here
    rather than manually adding in jobs, overtaping the real problem.

diff --git a/src/core/device.c b/src/core/device.c
index 19fc745..4ff7c37 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -264,7 +264,6 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
                         FOREACH_WORD_QUOTED(w, l, wants, state) {
                                 _cleanup_free_ char *n = NULL;
                                 char e[l+1];
-                                Unit *other;
 
                                 memcpy(e, w, l);
                                 e[l] = 0;
@@ -278,15 +277,6 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
                                 r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true);
                                 if (r < 0)
                                         goto fail;
-
-                                other = manager_get_unit(u->manager, n);
-                                if (!other || !unit_can_start(other))
-                                        continue;
-
-                                r = manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
-                                if (r < 0)
-                                        log_warning("Failed to add job %s/%s, ignoring: %s.",
-                                                    other->id, job_type_to_string(JOB_START), strerror(-r));
                         }
                 }
         }

commit 98088803bb2a9f89b7bbc063123dda3343138f18
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Dec 10 18:53:03 2013 +0000

    util: check for overflow in greedy_realloc()

diff --git a/src/shared/util.c b/src/shared/util.c
index 9c07392..1c35edf 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5792,12 +5792,18 @@ void* greedy_realloc(void **p, size_t *allocated, size_t need) {
         size_t a;
         void *q;
 
+        assert(p);
         assert(allocated);
 
         if (*allocated >= need)
                 return *p;
 
         a = MAX(64u, need * 2);
+
+        /* check for overflows */
+        if (a < need)
+                return NULL;
+
         q = realloc(*p, a);
         if (!q)
                 return NULL;
@@ -5808,9 +5814,14 @@ void* greedy_realloc(void **p, size_t *allocated, size_t need) {
 }
 
 void* greedy_realloc0(void **p, size_t *allocated, size_t need) {
-        size_t prev = *allocated;
+        size_t prev;
         uint8_t *q;
 
+        assert(p);
+        assert(allocated);
+
+        prev = *allocated;
+
         q = greedy_realloc(p, allocated, need);
         if (!q)
                 return NULL;



More information about the systemd-commits mailing list