[systemd-commits] src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Fri Mar 22 20:34:20 PDT 2013


 src/shared/conf-parser.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 4589f5bb0a973e9a41be93de06c87072cea4dfb9
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Mar 23 04:32:43 2013 +0100

    conf-parser: when we parse a string list, always fill in something
    
    Some code really wants to know whether there was a string list parsed,
    so don't take the shortcut here, and always allocate a string list, even
    if it is an empty one.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=62558

diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index b09e90a..c2cf5a6 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -705,9 +705,18 @@ int config_parse_strv(
         assert(data);
 
         if (isempty(rvalue)) {
-                /* Empty assignment resets the list */
+                char **empty;
+
+                /* Empty assignment resets the list. As a special rule
+                 * we actually fill in a real empty array here rather
+                 * than NULL, since some code wants to know if
+                 * something was set at all... */
+                empty = strv_new(NULL, NULL);
+                if (!empty)
+                        return log_oom();
+
                 strv_free(*sv);
-                *sv = NULL;
+                *sv = empty;
                 return 0;
         }
 



More information about the systemd-commits mailing list