]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
socket: Symlinks= with empty string resets the list of paths.
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 5 Sep 2017 06:08:59 +0000 (15:08 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 5 Sep 2017 06:08:59 +0000 (15:08 +0900)
man/systemd.socket.xml
src/core/load-fragment.c

index 1d20a8f7f758270f9c65b9cb1c90b8539f54ea09..1409b0c5f49cad979c8a33f7716bc231d61ae5e0 100644 (file)
         is used, only one AF_UNIX socket in the file system or one
         FIFO may be configured for the socket unit. Use this option to
         manage one or more symlinked alias names for a socket, binding
-        their lifecycle together. Defaults to the empty
-        list.</para></listitem>
+        their lifecycle together. If the empty string is assigned, the
+        list of paths is reset. Defaults to the empty list.</para></listitem>
       </varlistentry>
 
       <varlistentry>
index 7fa1bafaef71af0800f922a433cb9604759c38d6..4d0a0bb142ccb7260977bf0ddd176bbbd864b40a 100644 (file)
@@ -283,6 +283,23 @@ int config_parse_unit_path_strv_printf(
         assert(rvalue);
         assert(u);
 
+        if (isempty(rvalue)) {
+                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 = new0(char*, 1);
+                if (!empty)
+                        return log_oom();
+
+                strv_free(*x);
+                *x = empty;
+
+                return 0;
+        }
+
         for (p = rvalue;;) {
                 _cleanup_free_ char *word = NULL, *k = NULL;