]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #4536 from poettering/seccomp-namespaces
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 9 Nov 2016 00:54:21 +0000 (19:54 -0500)
committerGitHub <noreply@github.com>
Wed, 9 Nov 2016 00:54:21 +0000 (19:54 -0500)
core: add new RestrictNamespaces= unit file setting

Merging, not rebasing, because this touches many files and there were tree-wide cleanups in the mean time.

104 files changed:
Makefile.am
TODO
configure.ac
man/tmpfiles.d.xml
src/basic/cgroup-util.c
src/basic/env-util.c
src/basic/env-util.h
src/basic/format-util.h [moved from src/basic/formats-util.h with 100% similarity]
src/basic/log.c
src/basic/process-util.h
src/basic/rlimit-util.c
src/basic/socket-util.c
src/basic/string-util.h
src/basic/time-util.c
src/basic/time-util.h
src/basic/user-util.c
src/basic/util.c
src/basic/util.h
src/core/automount.c
src/core/busname.c
src/core/dbus-manager.c
src/core/device.c
src/core/execute.c
src/core/killall.c
src/core/load-fragment.c
src/core/main.c
src/core/mount.c
src/core/namespace.c
src/core/service.c
src/core/socket.c
src/core/swap.c
src/core/unit-printf.c
src/core/unit.c
src/coredump/coredump.c
src/coredump/stacktrace.c
src/delta/delta.c
src/gpt-auto-generator/gpt-auto-generator.c
src/initctl/initctl.c
src/journal-remote/journal-upload.c
src/journal/journald-console.c
src/journal/journald-kmsg.c
src/journal/journald-server.c
src/journal/journald-syslog.c
src/journal/journald-wall.c
src/journal/journald.c
src/journal/sd-journal.c
src/libsystemd/libsystemd.pc.in
src/libsystemd/sd-bus/bus-control.c
src/libsystemd/sd-bus/bus-creds.c
src/libsystemd/sd-bus/bus-dump.c
src/libsystemd/sd-bus/bus-kernel.c
src/libsystemd/sd-bus/bus-socket.c
src/libsystemd/sd-bus/test-bus-chat.c
src/libsystemd/sd-login/sd-login.c
src/libsystemd/sd-login/test-login.c
src/libsystemd/sd-netlink/netlink-message.c
src/libsystemd/sd-netlink/netlink-socket.c
src/libsystemd/sd-netlink/rtnl-message.c
src/libudev/libudev-monitor.c
src/libudev/libudev.pc.in
src/login/inhibit.c
src/login/logind-acl.c
src/login/logind-action.c
src/login/logind-dbus.c
src/login/logind-inhibit.c
src/login/logind-seat.c
src/login/logind-session.c
src/login/logind-user-dbus.c
src/login/logind-user.c
src/login/logind-utmp.c
src/login/logind.c
src/login/pam_systemd.c
src/machine/machine-dbus.c
src/machine/machine.c
src/machine/machinectl.c
src/machine/machined-dbus.c
src/machine/machined.c
src/network/networkd-network.c
src/notify/notify.c
src/nspawn/nspawn-mount.c
src/nspawn/nspawn.c
src/run/run.c
src/shared/acl-util.c
src/shared/ask-password-api.c
src/shared/cgroup-show.c
src/shared/clean-ipc.c
src/shared/conf-parser.c
src/shared/install-printf.c
src/shared/logs-show.c
src/systemctl/systemctl.c
src/sysusers/sysusers.c
src/test/test-cgroup-util.c
src/test/test-log.c
src/test/test-string-util.c
src/test/test-tmpfiles.c
src/timesync/timesyncd-manager.c
src/tmpfiles/tmpfiles.c
src/udev/udev-ctrl.c
src/udev/udev-event.c
src/udev/udev-node.c
src/udev/udevadm-monitor.c
src/udev/udevd.c
src/update-utmp/update-utmp.c
test/TEST-03-JOBS/test-jobs.sh

index 1031e797b38b57e1d8adbeb7f3e1495bf2117717..50da458918a0dcc6362d1897ce774cee9c869330 100644 (file)
@@ -932,7 +932,7 @@ libbasic_la_SOURCES = \
        src/basic/copy.h \
        src/basic/alloc-util.h \
        src/basic/alloc-util.c \
-       src/basic/formats-util.h \
+       src/basic/format-util.h \
        src/basic/nss-util.h
 
 nodist_libbasic_la_SOURCES = \
@@ -6056,6 +6056,7 @@ EXTRA_DIST += \
 
 # ------------------------------------------------------------------------------
 substitutions = \
+       '|rootlibdir=$(rootlibdir)|' \
        '|rootlibexecdir=$(rootlibexecdir)|' \
        '|rootbindir=$(rootbindir)|' \
        '|bindir=$(bindir)|' \
diff --git a/TODO b/TODO
index 164e33708e7a7489c5ee705ddd35bc9c5c8a7f88..baaac9407fcbc9535bbe18b610dacee9be6e0880 100644 (file)
--- a/TODO
+++ b/TODO
@@ -23,9 +23,6 @@ External:
 
 Janitorial Clean-ups:
 
-* code cleanup: retire FOREACH_WORD_QUOTED, port to extract_first_word() loops instead.
-  For example, most conf parsing callbacks should use it.
-
 * replace manual readdir() loops with FOREACH_DIRENT or FOREACH_DIRENT_ALL
 
 * Rearrange tests so that the various test-xyz.c match a specific src/basic/xyz.c again
index 0b10fc7de771b86b220c110fdefead4418fcf938..7f6b3b937c92cc4cdc777fd22ed30cc7a9ecce2e 100644 (file)
@@ -97,8 +97,6 @@ AC_PATH_PROG([M4], [m4])
 AC_PATH_PROG([QUOTAON], [quotaon], [/usr/sbin/quotaon], [$PATH:/usr/sbin:/sbin])
 AC_PATH_PROG([QUOTACHECK], [quotacheck], [/usr/sbin/quotacheck], [$PATH:/usr/sbin:/sbin])
 
-AC_PATH_PROG([SETCAP], [setcap], [/usr/sbin/setcap], [$PATH:/usr/sbin:/sbin])
-
 AC_PATH_PROG([KILL], [kill], [/usr/bin/kill], [$PATH:/usr/sbin:/sbin])
 
 AC_PATH_PROG([KMOD], [kmod], [/usr/bin/kmod], [$PATH:/usr/sbin:/sbin])
@@ -218,25 +216,21 @@ AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
                [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-flto])],
                [AC_MSG_RESULT([disabling -flto as requested])])],
         [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
-AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
 
 AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
         [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
                -Wp,-D_FORTIFY_SOURCE=2])],
         [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
-AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags")
 
 AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
         [CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
                -Wl,--gc-sections])],
         [AC_MSG_RESULT([skipping --gc-sections, optimization not enabled])])
-AC_SUBST([OUR_CFLAGS], "$with_ldflags $sanitizer_cflags")
 
 AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
         [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
                -ffunction-sections -fdata-sections])],
         [AC_MSG_RESULT([skipping -ffunction/data-section, optimization not enabled])])
-AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
 
 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
         -Wl,--as-needed \
@@ -245,6 +239,9 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
         -Wl,-z,now \
         -pie \
         -Wl,-fuse-ld=gold])
+
+AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags")
+AC_SUBST([OUR_CFLAGS], "-D__SANE_USERSPACE_TYPES__ $with_cflags $sanitizer_cflags")
 AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
 
 AC_CHECK_SIZEOF(pid_t)
index e040a1636d20204eaa9d6bfb015ae0615977a558..555e9c2d56c854d8eb3af02bc2eb6cfd53d37da2 100644 (file)
     type, path, mode, ownership, age, and argument fields:</para>
 
     <programlisting>#Type Path        Mode UID  GID  Age Argument
-    d    /run/user   0755 root root 10d -
-    L    /tmp/foobar -    -    -    -   /dev/null</programlisting>
+    /run/user   0755 root root 10d -
+    /tmp/foobar -    -    -    -   /dev/null</programlisting>
 
     <para>Fields may be enclosed within quotes and contain C-style escapes.</para>
 
           <term><varname>d</varname></term>
           <listitem><para>Create a directory. The mode and ownership will be adjusted if
           specified and the directory already exists. Contents of this directory are subject
-          to time based cleanup if the time argument is specified.</para></listitem>
+          to time based cleanup if the age argument is specified.</para></listitem>
         </varlistentry>
 
         <varlistentry>
 
         <varlistentry>
           <term><varname>e</varname></term>
-          <listitem><para>Similar to <varname>d</varname>, but the directory will not be
-          created if it does not exist. Lines of this type accept shell-style globs in
-          place of normal path names.</para></listitem>
+          <listitem><para>Similar to <varname>d</varname>, but the directory will not be created if
+          it does not exist. Lines of this type accept shell-style globs in place of normal path
+          names. For this entry to be useful, at least one of the mode, uid, gid, or age arguments
+          must be specified, since otherwise this entry has no effect. If the age argument is
+          <literal>0</literal>, contents of the directory will be unconditionally deleted every time
+          <command>systemd-tmpfiles --clean</command> is run. This can be useful when combined with
+          <varname>!</varname>, see the examples.</para></listitem>
         </varlistentry>
 
         <varlistentry>
@@ -680,6 +684,18 @@ e  /var/chache/dnf/ - - - 30d
      <filename>/var/chache/dnf/</filename> will be removed after they have not been
      accessed in 30 days.</para>
     </example>
+
+    <example>
+      <title>Empty the contents of a cache directory on boot</title>
+
+      <programlisting># /usr/lib/tmpfiles.d/krb5rcache.conf
+e! /var/cache/krb5rcache - - - 0
+</programlisting>
+
+      <para>Any files and subdirectories in <filename>/var/cache/krb5rcache/</filename>
+      will be removed on boot. The directory will not be created.
+      </para>
+    </example>
   </refsect1>
 
   <refsect1>
index 5fce32f769386ee971804882125ea35e32154d4c..5e73753935a8045cd069b5a62e6e2a1e87806b52 100644 (file)
@@ -38,7 +38,7 @@
 #include "extract-word.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "log.h"
 #include "login-util.h"
index b74290d6fd49ad721660c924c239d29f96cda990..7c69ccdaf94a512386813ad22755fdd858854aa5 100644 (file)
@@ -384,6 +384,28 @@ char **strv_env_unset_many(char **l, ...) {
         return l;
 }
 
+int strv_env_replace(char ***l, char *p) {
+        char **f;
+
+        assert(p);
+
+        /* Replace first occurrence of the env var or add a new one in the
+         * string list. Drop other occurences. Edits in-place. Does not copy p.
+         */
+
+        for (f = *l; f && *f; f++)
+                if (env_match(*f, p)) {
+                        free_and_replace(*f, p);
+                        strv_env_unset(f + 1, p);
+                        return 0;
+                }
+
+        /* We didn't find a match, we need to append p or create a new strv */
+        if (strv_push(l, p) < 0)
+                return -ENOMEM;
+        return 1;
+}
+
 char **strv_env_set(char **x, const char *p) {
 
         char **k, **r;
index b1fef704c2ae8f5a0eab7b354c1988ec91a29660..8cb0fc21318460eff74341635a87982b275646b3 100644 (file)
@@ -44,6 +44,7 @@ char **strv_env_delete(char **x, unsigned n_lists, ...); /* New copy */
 char **strv_env_set(char **x, const char *p); /* New copy ... */
 char **strv_env_unset(char **l, const char *p); /* In place ... */
 char **strv_env_unset_many(char **l, ...) _sentinel_;
+int strv_env_replace(char ***l, char *p); /* In place ... */
 
 char *strv_env_get_n(char **l, const char *name, size_t k) _pure_;
 char *strv_env_get(char **x, const char *n) _pure_;
index 4919d175da2c845c51172fbbcc34615ace787d97..f5cff4cc9f041b3a6c65909b4243e3d92f450cb7 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "alloc-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "io-util.h"
 #include "log.h"
 #include "macro.h"
index 2568e3834fc5e30353c1bd0aa09f49ab76969d7b..89dfeb4d6a42f94dcf8ecc7431b826164e7ece96 100644 (file)
@@ -28,7 +28,7 @@
 #include <sys/types.h>
 #include <sys/resource.h>
 
-#include "formats-util.h"
+#include "format-util.h"
 #include "macro.h"
 
 #define procfs_file_alloca(pid, field)                                  \
index ee063720edb15abc9c9694ea247f3b0c8515e1a8..ca834df621311b52c85a5972ea2eb27bb51a54cb 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "alloc-util.h"
 #include "extract-word.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "macro.h"
 #include "missing.h"
 #include "rlimit-util.h"
index 1662c047050aae55c49dc3d059a001194dd6795e..4ebf10610902aa472e668cd417a2890c2ab5e1f2 100644 (file)
@@ -34,7 +34,7 @@
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "log.h"
 #include "macro.h"
 #include "missing.h"
index 0175803302a34b41b45b732f25f565a3f2c38c1b..e99f7964be5f38e314a8b5d62c46239c73824d9d 100644 (file)
@@ -107,9 +107,6 @@ const char* split(const char **state, size_t *l, const char *separator, bool quo
 #define FOREACH_WORD_SEPARATOR(word, length, s, separator, state)       \
         _FOREACH_WORD(word, length, s, separator, false, state)
 
-#define FOREACH_WORD_QUOTED(word, length, s, state)                     \
-        _FOREACH_WORD(word, length, s, WHITESPACE, true, state)
-
 #define _FOREACH_WORD(word, length, s, separator, quoted, state)        \
         for ((state) = (s), (word) = split(&(state), &(length), (separator), (quoted)); (word); (word) = split(&(state), &(length), (separator), (quoted)))
 
index fedff1362c3ce009d46d488ea03d520ecfab7681..cbdfd55ada7acbfe1719d908cc75bc9fdedb6179 100644 (file)
@@ -309,7 +309,7 @@ static char *format_timestamp_internal(
                 if (n + 8 > l)
                         return NULL; /* Microseconds part doesn't fit. */
 
-                sprintf(buf + n, ".%06llu", (unsigned long long) (t % USEC_PER_SEC));
+                sprintf(buf + n, ".%06"PRI_USEC, t % USEC_PER_SEC);
         }
 
         /* Append the timezone */
@@ -499,11 +499,11 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) {
 
                         if (j > 0) {
                                 k = snprintf(p, l,
-                                             "%s"USEC_FMT".%0*llu%s",
+                                             "%s"USEC_FMT".%0*"PRI_USEC"%s",
                                              p > buf ? " " : "",
                                              a,
                                              j,
-                                             (unsigned long long) b,
+                                             b,
                                              table[i].suffix);
 
                                 t = 0;
@@ -1320,7 +1320,7 @@ unsigned long usec_to_jiffies(usec_t u) {
                 r = sysconf(_SC_CLK_TCK);
 
                 assert(r > 0);
-                hz = (unsigned long) r;
+                hz = r;
         }
 
         return DIV_ROUND_UP(u , USEC_PER_SEC / hz);
index 558b0b5b7fe8c174221140a94857f6b981363469..f67a4474ed49ec196c30ac15872571a68a7c73b5 100644 (file)
 typedef uint64_t usec_t;
 typedef uint64_t nsec_t;
 
-#define NSEC_FMT "%" PRIu64
-#define USEC_FMT "%" PRIu64
+#define PRI_NSEC PRIu64
+#define PRI_USEC PRIu64
+#define NSEC_FMT "%" PRI_NSEC
+#define USEC_FMT "%" PRI_USEC
 
 #include "macro.h"
 
index de6c93056eca7c140241fe834520b9621804f1dc..938533d2e7688a28c8ab3e294ca4c013d0641b87 100644 (file)
@@ -34,7 +34,7 @@
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "macro.h"
 #include "missing.h"
 #include "parse-util.h"
index 0f65e4839cf05f43513d781594b3bab4491ca83b..c1b5ca1ef7b7d6f9c0b0717be62746edb2787a34 100644 (file)
@@ -41,7 +41,7 @@
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hashmap.h"
 #include "hostname-util.h"
 #include "log.h"
index bb2fc318ef7dfda3effe6e1f46d0177f305272da..c3802a811cdfcc2c7c97724e50adee054c5468cf 100644 (file)
@@ -41,7 +41,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "formats-util.h"
+#include "format-util.h"
 #include "macro.h"
 #include "missing.h"
 #include "time-util.h"
index 7d7a0a6e46bf44b22839a809860401de6813b788..5fa6eb7b1841dedcc26e58140c4e575284c44cf3 100644 (file)
@@ -34,7 +34,7 @@
 #include "bus-util.h"
 #include "dbus-automount.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "io-util.h"
 #include "label.h"
 #include "mkdir.h"
index b96ec09e673639b6954e4db3320739c3af63748c..88b758eecbe086fb5ae97b07353224d86aca52f9 100644 (file)
@@ -27,7 +27,7 @@
 #include "busname.h"
 #include "dbus-busname.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "kdbus.h"
 #include "parse-util.h"
 #include "process-util.h"
index d7d3d3c8ce0b8f00ed62ae8672c072797f1975e4..5a7922a24974f3b43ab344dedbd8ec144a3f2330 100644 (file)
@@ -34,7 +34,7 @@
 #include "env-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "install.h"
 #include "log.h"
 #include "path-util.h"
index 498351af111fb922db507c349d7ee97c5d148d55..c572a6737cd75a177fdaffac48fd58b3afd5bc79 100644 (file)
@@ -256,39 +256,33 @@ static int device_update_description(Unit *u, struct udev_device *dev, const cha
 }
 
 static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
-        const char *wants;
-        const char *word, *state;
-        size_t l;
+        const char *wants, *property, *p;
         int r;
-        const char *property;
 
         assert(u);
         assert(dev);
 
         property = MANAGER_IS_USER(u->manager) ? "SYSTEMD_USER_WANTS" : "SYSTEMD_WANTS";
         wants = udev_device_get_property_value(dev, property);
-        if (!wants)
-                return 0;
-
-        FOREACH_WORD_QUOTED(word, l, wants, state) {
-                _cleanup_free_ char *n = NULL;
-                char e[l+1];
+        for (p = wants;;) {
+                _cleanup_free_ char *word = NULL, *k = NULL;
 
-                memcpy(e, word, l);
-                e[l] = 0;
+                r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
+                        return log_oom();
+                if (r < 0)
+                        return log_unit_error_errno(u, r, "Failed to add parse %s: %m", property);
 
-                r = unit_name_mangle(e, UNIT_NAME_NOGLOB, &n);
+                r = unit_name_mangle(word, UNIT_NAME_NOGLOB, &k);
                 if (r < 0)
-                        return log_unit_error_errno(u, r, "Failed to mangle unit name: %m");
+                        return log_unit_error_errno(u, r, "Failed to mangle unit name \"%s\": %m", word);
 
-                r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true);
+                r = unit_add_dependency_by_name(u, UNIT_WANTS, k, NULL, true);
                 if (r < 0)
                         return log_unit_error_errno(u, r, "Failed to add wants dependency: %m");
         }
-        if (!isempty(state))
-                log_unit_warning(u, "Property %s on %s has trailing garbage, ignoring.", property, strna(udev_device_get_syspath(dev)));
-
-        return 0;
 }
 
 static int device_setup_unit(Manager *m, struct udev_device *dev, const char *path, bool main) {
@@ -423,26 +417,22 @@ static int device_process_new(Manager *m, struct udev_device *dev) {
         /* Add additional units for all explicitly configured
          * aliases */
         alias = udev_device_get_property_value(dev, "SYSTEMD_ALIAS");
-        if (alias) {
-                const char *word, *state;
-                size_t l;
-
-                FOREACH_WORD_QUOTED(word, l, alias, state) {
-                        char e[l+1];
+        for (;;) {
+                _cleanup_free_ char *word = NULL, *k = NULL;
 
-                        memcpy(e, word, l);
-                        e[l] = 0;
+                r = extract_first_word(&alias, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
+                        return log_oom();
+                if (r < 0)
+                        return log_warning_errno(r, "Failed to add parse SYSTEMD_ALIAS for %s: %m", sysfs);
 
-                        if (path_is_absolute(e))
-                                (void) device_setup_unit(m, dev, e, false);
-                        else
-                                log_warning("SYSTEMD_ALIAS for %s is not an absolute path, ignoring: %s", sysfs, e);
-                }
-                if (!isempty(state))
-                        log_warning("SYSTEMD_ALIAS for %s has trailing garbage, ignoring.", sysfs);
+                if (path_is_absolute(word))
+                        (void) device_setup_unit(m, dev, word, false);
+                else
+                        log_warning("SYSTEMD_ALIAS for %s is not an absolute path, ignoring: %s", sysfs, word);
         }
-
-        return 0;
 }
 
 static void device_update_found_one(Device *d, bool add, DeviceFound found, bool now) {
index b8a02461736ccc73128d5a07cb81de8d5732fe5f..8015aa2cb9f144fd2096107182bd21bda6d9dc7c 100644 (file)
@@ -71,7 +71,7 @@
 #include "exit-status.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "glob-util.h"
 #include "io-util.h"
index a8b814e8685cf6ae8721c8cc17f30b36599ef279..3bc19e9c842ba802f83d9acbb9dde998f9461d8a 100644 (file)
@@ -25,7 +25,7 @@
 #include "alloc-util.h"
 #include "def.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "killall.h"
 #include "parse-util.h"
 #include "process-util.h"
index e0fa484c1e8edf2fbcb2ee4baf4c44b5d6968e30..52079980d8357f22cacd0e9b773cbeda8e1aecea 100644 (file)
@@ -269,26 +269,33 @@ int config_parse_unit_path_strv_printf(
                 void *userdata) {
 
         char ***x = data;
-        const char *word, *state;
         Unit *u = userdata;
-        size_t l;
         int r;
+        const char *p;
 
         assert(filename);
         assert(lvalue);
         assert(rvalue);
         assert(u);
 
-        FOREACH_WORD_QUOTED(word, l, rvalue, state) {
-                _cleanup_free_ char *k = NULL;
-                char t[l+1];
+        for (p = rvalue;;) {
+                _cleanup_free_ char *word = NULL, *k = NULL;
 
-                memcpy(t, word, l);
-                t[l] = 0;
+                r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
+                        return log_oom();
+                if (r < 0) {
+                        log_syntax(unit, LOG_WARNING, filename, line, r,
+                                   "Invalid syntax, ignoring: %s", rvalue);
+                        return 0;
+                }
 
-                r = unit_full_printf(u, t, &k);
+                r = unit_full_printf(u, word, &k);
                 if (r < 0) {
-                        log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers on %s, ignoring: %m", t);
+                        log_syntax(unit, LOG_ERR, filename, line, r,
+                                   "Failed to resolve unit specifiers on \"%s\", ignoring: %m", word);
                         return 0;
                 }
 
@@ -298,7 +305,8 @@ int config_parse_unit_path_strv_printf(
                 }
 
                 if (!path_is_absolute(k)) {
-                        log_syntax(unit, LOG_ERR, filename, line, 0, "Symlink path %s is not absolute, ignoring: %m", k);
+                        log_syntax(unit, LOG_ERR, filename, line, 0,
+                                   "Symlink path is not absolute: %s", k);
                         return 0;
                 }
 
@@ -307,13 +315,8 @@ int config_parse_unit_path_strv_printf(
                 r = strv_push(x, k);
                 if (r < 0)
                         return log_oom();
-
                 k = NULL;
         }
-        if (!isempty(state))
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid syntax, ignoring.");
-
-        return 0;
 }
 
 int config_parse_socket_listen(const char *unit,
@@ -606,7 +609,7 @@ int config_parse_exec(
 
                 semicolon = false;
 
-                r = extract_first_word_and_warn(&p, &firstword, WHITESPACE, EXTRACT_QUOTES|EXTRACT_CUNESCAPE, unit, filename, line, rvalue);
+                r = extract_first_word_and_warn(&p, &firstword, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE, unit, filename, line, rvalue);
                 if (r <= 0)
                         return 0;
 
@@ -695,7 +698,7 @@ int config_parse_exec(
                                 continue;
                         }
 
-                        r = extract_first_word_and_warn(&p, &word, WHITESPACE, EXTRACT_QUOTES|EXTRACT_CUNESCAPE, unit, filename, line, rvalue);
+                        r = extract_first_word_and_warn(&p, &word, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE, unit, filename, line, rvalue);
                         if (r == 0)
                                 break;
                         else if (r < 0)
@@ -1062,8 +1065,8 @@ int config_parse_exec_secure_bits(const char *unit,
                                   void *userdata) {
 
         ExecContext *c = data;
-        size_t l;
-        const char *word, *state;
+        const char *p;
+        int r;
 
         assert(filename);
         assert(lvalue);
@@ -1076,28 +1079,38 @@ int config_parse_exec_secure_bits(const char *unit,
                 return 0;
         }
 
-        FOREACH_WORD_QUOTED(word, l, rvalue, state) {
-                if (first_word(word, "keep-caps"))
+        for (p = rvalue;;) {
+                _cleanup_free_ char *word = NULL;
+
+                r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
+                        return log_oom();
+                if (r < 0) {
+                        log_syntax(unit, LOG_WARNING, filename, line, r,
+                                   "Invalid syntax, ignoring: %s", rvalue);
+                        return 0;
+                }
+
+                if (streq(word, "keep-caps"))
                         c->secure_bits |= 1<<SECURE_KEEP_CAPS;
-                else if (first_word(word, "keep-caps-locked"))
+                else if (streq(word, "keep-caps-locked"))
                         c->secure_bits |= 1<<SECURE_KEEP_CAPS_LOCKED;
-                else if (first_word(word, "no-setuid-fixup"))
+                else if (streq(word, "no-setuid-fixup"))
                         c->secure_bits |= 1<<SECURE_NO_SETUID_FIXUP;
-                else if (first_word(word, "no-setuid-fixup-locked"))
+                else if (streq(word, "no-setuid-fixup-locked"))
                         c->secure_bits |= 1<<SECURE_NO_SETUID_FIXUP_LOCKED;
-                else if (first_word(word, "noroot"))
+                else if (streq(word, "noroot"))
                         c->secure_bits |= 1<<SECURE_NOROOT;
-                else if (first_word(word, "noroot-locked"))
+                else if (streq(word, "noroot-locked"))
                         c->secure_bits |= 1<<SECURE_NOROOT_LOCKED;
                 else {
-                        log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse secure bits, ignoring: %s", rvalue);
+                        log_syntax(unit, LOG_ERR, filename, line, 0,
+                                   "Failed to parse secure bit \"%s\", ignoring.", word);
                         return 0;
                 }
         }
-        if (!isempty(state))
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid syntax, garbage at the end, ignoring.");
-
-        return 0;
 }
 
 int config_parse_capability_set(
@@ -1951,7 +1964,7 @@ int config_parse_user_group_strv(
         for (;;) {
                 _cleanup_free_ char *word = NULL, *k = NULL;
 
-                r = extract_first_word(&p, &word, WHITESPACE, 0);
+                r = extract_first_word(&p, &word, NULL, 0);
                 if (r == 0)
                         break;
                 if (r == -ENOMEM)
@@ -2210,10 +2223,8 @@ int config_parse_environ(const char *unit,
                          void *userdata) {
 
         Unit *u = userdata;
-        char*** env = data;
-        const char *word, *state;
-        size_t l;
-        _cleanup_free_ char *k = NULL;
+        char ***env = data;
+        const char *p;
         int r;
 
         assert(filename);
@@ -2227,46 +2238,43 @@ int config_parse_environ(const char *unit,
                 return 0;
         }
 
-        if (u) {
-                r = unit_full_printf(u, rvalue, &k);
+        for (p = rvalue;; ) {
+                _cleanup_free_ char *word = NULL, *k = NULL;
+
+                r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
+                        return log_oom();
                 if (r < 0) {
-                        log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %s", rvalue);
+                        log_syntax(unit, LOG_WARNING, filename, line, r,
+                                   "Invalid syntax, ignoring: %s", rvalue);
                         return 0;
                 }
-        }
-
-        if (!k) {
-                k = strdup(rvalue);
-                if (!k)
-                        return log_oom();
-        }
-
-        FOREACH_WORD_QUOTED(word, l, k, state) {
-                _cleanup_free_ char *n = NULL;
-                char **x;
 
-                r = cunescape_length(word, l, 0, &n);
-                if (r < 0) {
-                        log_syntax(unit, LOG_ERR, filename, line, r, "Couldn't unescape assignment, ignoring: %s", rvalue);
-                        continue;
+                if (u) {
+                        r = unit_full_printf(u, word, &k);
+                        if (r < 0) {
+                                log_syntax(unit, LOG_ERR, filename, line, r,
+                                           "Failed to resolve specifiers, ignoring: %s", k);
+                                continue;
+                        }
+                } else {
+                        k = word;
+                        word = NULL;
                 }
 
-                if (!env_assignment_is_valid(n)) {
-                        log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid environment assignment, ignoring: %s", rvalue);
+                if (!env_assignment_is_valid(k)) {
+                        log_syntax(unit, LOG_ERR, filename, line, 0,
+                                   "Invalid environment assignment, ignoring: %s", k);
                         continue;
                 }
 
-                x = strv_env_set(*env, n);
-                if (!x)
+                r = strv_env_replace(env, k);
+                if (r < 0)
                         return log_oom();
-
-                strv_free(*env);
-                *env = x;
+                k = NULL;
         }
-        if (!isempty(state))
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
-
-        return 0;
 }
 
 int config_parse_pass_environ(const char *unit,
@@ -2300,7 +2308,7 @@ int config_parse_pass_environ(const char *unit,
         for (;;) {
                 _cleanup_free_ char *word = NULL;
 
-                r = extract_first_word(&rvalue, &word, WHITESPACE, EXTRACT_QUOTES);
+                r = extract_first_word(&rvalue, &word, NULL, EXTRACT_QUOTES);
                 if (r == 0)
                         break;
                 if (r == -ENOMEM)
@@ -2538,37 +2546,39 @@ int config_parse_unit_requires_mounts_for(
                 void *userdata) {
 
         Unit *u = userdata;
-        const char *word, *state;
-        size_t l;
+        const char *p;
+        int r;
 
         assert(filename);
         assert(lvalue);
         assert(rvalue);
         assert(data);
 
-        FOREACH_WORD_QUOTED(word, l, rvalue, state) {
-                int r;
-                _cleanup_free_ char *n;
+        for (p = rvalue;; ) {
+                _cleanup_free_ char *word = NULL;
 
-                n = strndup(word, l);
-                if (!n)
+                r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
                         return log_oom();
+                if (r < 0) {
+                        log_syntax(unit, LOG_WARNING, filename, line, r,
+                                   "Invalid syntax, ignoring: %s", rvalue);
+                        return 0;
+                }
 
-                if (!utf8_is_valid(n)) {
+                if (!utf8_is_valid(word)) {
                         log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
                         continue;
                 }
 
-                r = unit_require_mounts_for(u, n);
+                r = unit_require_mounts_for(u, word);
                 if (r < 0) {
-                        log_syntax(unit, LOG_ERR, filename, line, r, "Failed to add required mount for, ignoring: %s", rvalue);
+                        log_syntax(unit, LOG_ERR, filename, line, r, "Failed to add required mount \"%s\", ignoring: %m", word);
                         continue;
                 }
         }
-        if (!isempty(state))
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
-
-        return 0;
 }
 
 int config_parse_documentation(const char *unit,
@@ -2760,8 +2770,7 @@ int config_parse_syscall_archs(
                 void *userdata) {
 
         Set **archs = data;
-        const char *word, *state;
-        size_t l;
+        const char *p;
         int r;
 
         if (isempty(rvalue)) {
@@ -2773,30 +2782,32 @@ int config_parse_syscall_archs(
         if (r < 0)
                 return log_oom();
 
-        FOREACH_WORD_QUOTED(word, l, rvalue, state) {
-                _cleanup_free_ char *t = NULL;
+        for (p = rvalue;;) {
+                _cleanup_free_ char *word = NULL;
                 uint32_t a;
 
-                t = strndup(word, l);
-                if (!t)
+                r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
                         return log_oom();
+                if (r < 0) {
+                        log_syntax(unit, LOG_WARNING, filename, line, r,
+                                   "Invalid syntax, ignoring: %s", rvalue);
+                        return 0;
+                }
 
-                r = seccomp_arch_from_string(t, &a);
+                r = seccomp_arch_from_string(word, &a);
                 if (r < 0) {
-                        log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse system call architecture, ignoring: %s", t);
+                        log_syntax(unit, LOG_ERR, filename, line, r,
+                                   "Failed to parse system call architecture \"%s\", ignoring: %m", word);
                         continue;
                 }
 
                 r = set_put(*archs, UINT32_TO_PTR(a + 1));
-                if (r == 0)
-                        continue;
                 if (r < 0)
                         return log_oom();
         }
-        if (!isempty(state))
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
-
-        return 0;
 }
 
 int config_parse_syscall_errno(
@@ -2848,8 +2859,7 @@ int config_parse_address_families(
 
         ExecContext *c = data;
         bool invert = false;
-        const char *word, *state;
-        size_t l;
+        const char *p;
         int r;
 
         assert(filename);
@@ -2876,36 +2886,38 @@ int config_parse_address_families(
                 c->address_families_whitelist = !invert;
         }
 
-        FOREACH_WORD_QUOTED(word, l, rvalue, state) {
-                _cleanup_free_ char *t = NULL;
+        for (p = rvalue;;) {
+                _cleanup_free_ char *word = NULL;
                 int af;
 
-                t = strndup(word, l);
-                if (!t)
+                r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
                         return log_oom();
+                if (r < 0) {
+                        log_syntax(unit, LOG_WARNING, filename, line, r,
+                                   "Invalid syntax, ignoring: %s", rvalue);
+                        return 0;
+                }
 
-                af = af_from_name(t);
+                af = af_from_name(word);
                 if (af <= 0)  {
-                        log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse address family, ignoring: %s", t);
+                        log_syntax(unit, LOG_ERR, filename, line, 0,
+                                   "Failed to parse address family \"%s\", ignoring: %m", word);
                         continue;
                 }
 
                 /* If we previously wanted to forbid an address family and now
-                 * we want to allow it, then remove it from the list
+                 * we want to allow it, then just remove it from the list.
                  */
                 if (!invert == c->address_families_whitelist)  {
                         r = set_put(c->address_families, INT_TO_PTR(af));
-                        if (r == 0)
-                                continue;
                         if (r < 0)
                                 return log_oom();
                 } else
                         set_remove(c->address_families, INT_TO_PTR(af));
         }
-        if (!isempty(state))
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
-
-        return 0;
 }
 
 int config_parse_restrict_namespaces(
@@ -3670,8 +3682,7 @@ int config_parse_runtime_directory(
 
         char***rt = data;
         Unit *u = userdata;
-        const char *word, *state;
-        size_t l;
+        const char *p;
         int r;
 
         assert(filename);
@@ -3685,34 +3696,38 @@ int config_parse_runtime_directory(
                 return 0;
         }
 
-        FOREACH_WORD_QUOTED(word, l, rvalue, state) {
-                _cleanup_free_ char *t = NULL, *n = NULL;
+        for (p = rvalue;;) {
+                _cleanup_free_ char *word = NULL, *k = NULL;
 
-                t = strndup(word, l);
-                if (!t)
+                r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0)
+                        return 0;
+                if (r == -ENOMEM)
                         return log_oom();
+                if (r < 0) {
+                        log_syntax(unit, LOG_WARNING, filename, line, r,
+                                   "Invalid syntax, ignoring: %s", rvalue);
+                        return 0;
+                }
 
-                r = unit_name_printf(u, t, &n);
+                r = unit_name_printf(u, word, &k);
                 if (r < 0) {
-                        log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
+                        log_syntax(unit, LOG_ERR, filename, line, r,
+                                   "Failed to resolve specifiers in \"%s\", ignoring: %m", word);
                         continue;
                 }
 
-                if (!filename_is_valid(n)) {
-                        log_syntax(unit, LOG_ERR, filename, line, 0, "Runtime directory is not valid, ignoring assignment: %s", rvalue);
+                if (!filename_is_valid(k)) {
+                        log_syntax(unit, LOG_ERR, filename, line, 0,
+                                   "Runtime directory is not valid, ignoring assignment: %s", rvalue);
                         continue;
                 }
 
-                r = strv_push(rt, n);
+                r = strv_push(rt, k);
                 if (r < 0)
                         return log_oom();
-
-                n = NULL;
+                k = NULL;
         }
-        if (!isempty(state))
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
-
-        return 0;
 }
 
 int config_parse_set_status(
index 94602611a72ca96a337a38fa0de8997c918b0f1d..f5f7df838d9849c534226c0ab10e456b694b3e79 100644 (file)
@@ -53,7 +53,7 @@
 #include "fd-util.h"
 #include "fdset.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "hostname-setup.h"
 #include "ima-setup.h"
@@ -574,7 +574,7 @@ static int config_parse_join_controllers(const char *unit,
                 char **l;
                 int r;
 
-                r = extract_first_word(&rvalue, &word, WHITESPACE, EXTRACT_QUOTES);
+                r = extract_first_word(&rvalue, &word, NULL, EXTRACT_QUOTES);
                 if (r < 0) {
                         log_syntax(unit, LOG_ERR, filename, line, r, "Invalid value for %s: %s", lvalue, whole_rvalue);
                         return r;
index d749e49df5b37f719f4cd8d48008fb4dd2cff46a..43e0f1c7466760e20b39fee5ebff50f3e98b3a8f 100644 (file)
@@ -28,7 +28,7 @@
 #include "dbus-mount.h"
 #include "escape.h"
 #include "exit-status.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fstab-util.h"
 #include "log.h"
 #include "manager.h"
index db9a7aa5e789babe536d058cd91bbb046ac29a3b..f361e139ace918b636bbdfd6909f72b4bdded619 100644 (file)
@@ -58,8 +58,7 @@ typedef enum MountMode {
 } MountMode;
 
 typedef struct BindMount {
-        const char *path; /* stack memory, doesn't need to be freed explicitly */
-        char *chased; /* malloc()ed memory, needs to be freed */
+        char *path;
         MountMode mode;
         bool ignore; /* Ignore if path does not exist */
 } BindMount;
@@ -155,10 +154,23 @@ static const TargetMount protect_system_strict_table[] = {
         { "/root",      READWRITE,      true  },      /* ProtectHome= */
 };
 
-static void set_bind_mount(BindMount **p, const char *path, MountMode mode, bool ignore) {
-        (*p)->path = path;
-        (*p)->mode = mode;
-        (*p)->ignore = ignore;
+static void set_bind_mount(BindMount *p, char *path, MountMode mode, bool ignore) {
+        p->path = path;
+        p->mode = mode;
+        p->ignore = ignore;
+}
+
+static int append_one_mount(BindMount **p, const char *root_directory,
+                            const char *path, MountMode mode, bool ignore) {
+        char *lpath;
+        assert(p);
+
+        lpath = prefix_root(root_directory, path);
+        if (!lpath)
+                return -ENOMEM;
+
+        set_bind_mount((*p)++, lpath, mode, ignore);
+        return 0;
 }
 
 static int append_mounts(BindMount **p, char **strv, MountMode mode) {
@@ -168,6 +180,7 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) {
 
         STRV_FOREACH(i, strv) {
                 bool ignore = false;
+                char *path;
 
                 if (IN_SET(mode, INACCESSIBLE, READONLY, READWRITE) && startswith(*i, "-")) {
                         (*i)++;
@@ -177,8 +190,11 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) {
                 if (!path_is_absolute(*i))
                         return -EINVAL;
 
-                set_bind_mount(p, *i, mode, ignore);
-                (*p)++;
+                path = strdup(*i);
+                if (!path)
+                        return -ENOMEM;
+
+                set_bind_mount((*p)++, path, mode, ignore);
         }
 
         return 0;
@@ -196,13 +212,16 @@ static int append_target_mounts(BindMount **p, const char *root_directory, const
                  * declaration we do not support "-" at the beginning.
                  */
                 const TargetMount *m = &mounts[i];
-                const char *path = prefix_roota(root_directory, m->path);
+                char *path;
+
+                path = prefix_root(root_directory, m->path);
+                if (!path)
+                        return -ENOMEM;
 
                 if (!path_is_absolute(path))
                         return -EINVAL;
 
-                set_bind_mount(p, path, m->mode, m->ignore);
-                (*p)++;
+                set_bind_mount((*p)++, path, m->mode, m->ignore);
         }
 
         return 0;
@@ -309,6 +328,7 @@ static void drop_duplicates(BindMount *m, unsigned *n) {
                  * above. */
                 if (previous && path_equal(f->path, previous->path)) {
                         log_debug("%s is duplicate.", f->path);
+                        f->path = mfree(f->path);
                         continue;
                 }
 
@@ -336,6 +356,7 @@ static void drop_inaccessible(BindMount *m, unsigned *n) {
                  * it, as inaccessible paths really should drop the entire subtree. */
                 if (clear && path_startswith(f->path, clear)) {
                         log_debug("%s is masked by %s.", f->path, clear);
+                        f->path = mfree(f->path);
                         continue;
                 }
 
@@ -375,6 +396,7 @@ static void drop_nop(BindMount *m, unsigned *n) {
                         /* We found it, let's see if it's the same mode, if so, we can drop this entry */
                         if (found && p->mode == f->mode) {
                                 log_debug("%s is redundant by %s", f->path, p->path);
+                                f->path = mfree(f->path);
                                 continue;
                         }
                 }
@@ -401,6 +423,7 @@ static void drop_outside_root(const char *root_directory, BindMount *m, unsigned
 
                 if (!path_startswith(f->path, root_directory)) {
                         log_debug("%s is outside of root directory.", f->path);
+                        f->path = mfree(f->path);
                         continue;
                 }
 
@@ -651,19 +674,23 @@ static int chase_all_symlinks(const char *root_directory, BindMount *m, unsigned
          * chase the symlinks on our own first. This call wil do so for all entries and remove all entries where we
          * can't resolve the path, and which have been marked for such removal. */
 
-        for (f = m, t = m; f < m+*n; f++) {
+        for (f = m, t = m; f < m + *n; f++) {
+                _cleanup_free_ char *chased = NULL;
 
-                r = chase_symlinks(f->path, root_directory, &f->chased);
-                if (r == -ENOENT && f->ignore) /* Doesn't exist? Then remove it! */
+                r = chase_symlinks(f->path, root_directory, &chased);
+                if (r == -ENOENT && f->ignore) {
+                        /* Doesn't exist? Then remove it! */
+                        f->path = mfree(f->path);
                         continue;
+                }
                 if (r < 0)
                         return log_debug_errno(r, "Failed to chase symlinks for %s: %m", f->path);
 
-                if (path_equal(f->path, f->chased))
-                        f->chased = mfree(f->chased);
-                else {
-                        log_debug("Chased %s â†’ %s", f->path, f->chased);
-                        f->path = f->chased;
+                if (!path_equal(f->path, chased)) {
+                        log_debug("Chased %s â†’ %s", f->path, chased);
+                        r = free_and_replace(f->path, chased);
+                        if (r < 0)
+                                return r;
                 }
 
                 *t = *f;
@@ -724,96 +751,96 @@ int setup_namespace(
 
         BindMount *m, *mounts = NULL;
         bool make_slave = false;
-        unsigned n;
+        unsigned n_mounts;
         int r = 0;
 
         if (mount_flags == 0)
                 mount_flags = MS_SHARED;
 
-        n = namespace_calculate_mounts(ns_info,
-                                       read_write_paths,
-                                       read_only_paths,
-                                       inaccessible_paths,
-                                       tmp_dir, var_tmp_dir,
-                                       protect_home, protect_system);
+        n_mounts = namespace_calculate_mounts(ns_info,
+                                              read_write_paths,
+                                              read_only_paths,
+                                              inaccessible_paths,
+                                              tmp_dir, var_tmp_dir,
+                                              protect_home, protect_system);
 
         /* Set mount slave mode */
-        if (root_directory || n > 0)
+        if (root_directory || n_mounts > 0)
                 make_slave = true;
 
-        if (n > 0) {
-                m = mounts = (BindMount *) alloca0(n * sizeof(BindMount));
+        if (n_mounts > 0) {
+                m = mounts = (BindMount *) alloca0(n_mounts * sizeof(BindMount));
                 r = append_mounts(&m, read_write_paths, READWRITE);
                 if (r < 0)
-                        return r;
+                        goto finish;
 
                 r = append_mounts(&m, read_only_paths, READONLY);
                 if (r < 0)
-                        return r;
+                        goto finish;
 
                 r = append_mounts(&m, inaccessible_paths, INACCESSIBLE);
                 if (r < 0)
-                        return r;
+                        goto finish;
 
                 if (tmp_dir) {
-                        m->path = prefix_roota(root_directory, "/tmp");
-                        m->mode = PRIVATE_TMP;
-                        m++;
+                        r = append_one_mount(&m, root_directory, "/tmp", PRIVATE_TMP, false);
+                        if (r < 0)
+                                goto finish;
                 }
 
                 if (var_tmp_dir) {
-                        m->path = prefix_roota(root_directory, "/var/tmp");
-                        m->mode = PRIVATE_VAR_TMP;
-                        m++;
+                        r = append_one_mount(&m, root_directory, "/var/tmp", PRIVATE_VAR_TMP, false);
+                        if (r < 0)
+                                goto finish;
                 }
 
                 if (ns_info->private_dev) {
-                        m->path = prefix_roota(root_directory, "/dev");
-                        m->mode = PRIVATE_DEV;
-                        m++;
+                        r = append_one_mount(&m, root_directory, "/dev", PRIVATE_DEV, false);
+                        if (r < 0)
+                                goto finish;
                 }
 
                 if (ns_info->protect_kernel_tunables) {
                         r = append_protect_kernel_tunables(&m, root_directory);
                         if (r < 0)
-                                return r;
+                                goto finish;
                 }
 
                 if (ns_info->protect_kernel_modules) {
                         r = append_protect_kernel_modules(&m, root_directory);
                         if (r < 0)
-                                return r;
+                                goto finish;
                 }
 
                 if (ns_info->protect_control_groups) {
-                        m->path = prefix_roota(root_directory, "/sys/fs/cgroup");
-                        m->mode = READONLY;
-                        m++;
+                        r = append_one_mount(&m, root_directory, "/sys/fs/cgroup", READONLY, false);
+                        if (r < 0)
+                                goto finish;
                 }
 
                 r = append_protect_home(&m, root_directory, protect_home);
                 if (r < 0)
-                        return r;
+                        goto finish;
 
                 r = append_protect_system(&m, root_directory, protect_system);
                 if (r < 0)
-                        return r;
+                        goto finish;
 
-                assert(mounts + n == m);
+                assert(mounts + n_mounts == m);
 
                 /* Resolve symlinks manually first, as mount() will always follow them relative to the host's
                  * root. Moreover we want to suppress duplicates based on the resolved paths. This of course is a bit
                  * racy. */
-                r = chase_all_symlinks(root_directory, mounts, &n);
+                r = chase_all_symlinks(root_directory, mounts, &n_mounts);
                 if (r < 0)
                         goto finish;
 
-                qsort(mounts, n, sizeof(BindMount), mount_path_compare);
+                qsort(mounts, n_mounts, sizeof(BindMount), mount_path_compare);
 
-                drop_duplicates(mounts, &n);
-                drop_outside_root(root_directory, mounts, &n);
-                drop_inaccessible(mounts, &n);
-                drop_nop(mounts, &n);
+                drop_duplicates(mounts, &n_mounts);
+                drop_outside_root(root_directory, mounts, &n_mounts);
+                drop_inaccessible(mounts, &n_mounts);
+                drop_nop(mounts, &n_mounts);
         }
 
         if (unshare(CLONE_NEWNS) < 0) {
@@ -843,25 +870,25 @@ int setup_namespace(
                 }
         }
 
-        if (n > 0) {
+        if (n_mounts > 0) {
                 char **blacklist;
                 unsigned j;
 
                 /* First round, add in all special mounts we need */
-                for (m = mounts; m < mounts + n; ++m) {
+                for (m = mounts; m < mounts + n_mounts; ++m) {
                         r = apply_mount(m, tmp_dir, var_tmp_dir);
                         if (r < 0)
                                 goto finish;
                 }
 
                 /* Create a blacklist we can pass to bind_mount_recursive() */
-                blacklist = newa(char*, n+1);
-                for (j = 0; j < n; j++)
+                blacklist = newa(char*, n_mounts+1);
+                for (j = 0; j < n_mounts; j++)
                         blacklist[j] = (char*) mounts[j].path;
                 blacklist[j] = NULL;
 
                 /* Second round, flip the ro bits if necessary. */
-                for (m = mounts; m < mounts + n; ++m) {
+                for (m = mounts; m < mounts + n_mounts; ++m) {
                         r = make_read_only(m, blacklist);
                         if (r < 0)
                                 goto finish;
@@ -886,8 +913,8 @@ int setup_namespace(
         r = 0;
 
 finish:
-        for (m = mounts; m < mounts + n; m++)
-                free(m->chased);
+        for (m = mounts; m < mounts + n_mounts; m++)
+                free(m->path);
 
         return r;
 }
index f6acc2f129e09ee919e2df95ccfb974be21079ae..7aa1fba5720a276f6bac5939e2ed6a5bdf4a42c4 100644 (file)
@@ -33,7 +33,7 @@
 #include "exit-status.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "load-dropin.h"
 #include "load-fragment.h"
index 0b1c4acfecd010a52ecf6a965c113c7d8e8ddbbb..ebacd74a47baeb3327ad1efb678f5361c72415a6 100644 (file)
@@ -36,7 +36,7 @@
 #include "def.h"
 #include "exit-status.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "io-util.h"
 #include "label.h"
 #include "log.h"
index 2228a254bbc1a06238ac3606c8a66b7d20eac884..b870ac88e3360457c14df1c868c479bf6922ae74 100644 (file)
@@ -29,7 +29,7 @@
 #include "escape.h"
 #include "exit-status.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fstab-util.h"
 #include "parse-util.h"
 #include "path-util.h"
index f11df42af389ff9a415b626592941e65f179b6bd..1f5dc6fd8872ba97ce37a41d343bcdf20eb5b9af 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "alloc-util.h"
 #include "cgroup-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "macro.h"
 #include "specifier.h"
 #include "string-util.h"
index fa1f3d9d4b244860b2ce5628dd154c5c20b8ec38..bba0f5d357c2c879f5eaaa9e90eab41542179d42 100644 (file)
@@ -36,7 +36,7 @@
 #include "escape.h"
 #include "execute.h"
 #include "fileio-label.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "id128-util.h"
 #include "load-dropin.h"
 #include "load-fragment.h"
index 6bd0e925eb6af20642a41d03503702f7dd1a8d57..d55d896df49a59d13a950b822cd1b4a26138365a 100644 (file)
@@ -111,7 +111,7 @@ static CoredumpStorage arg_storage = COREDUMP_STORAGE_EXTERNAL;
 static bool arg_compress = true;
 static uint64_t arg_process_size_max = PROCESS_SIZE_MAX;
 static uint64_t arg_external_size_max = EXTERNAL_SIZE_MAX;
-static size_t arg_journal_size_max = JOURNAL_SIZE_MAX;
+static uint64_t arg_journal_size_max = JOURNAL_SIZE_MAX;
 static uint64_t arg_keep_free = (uint64_t) -1;
 static uint64_t arg_max_use = (uint64_t) -1;
 
@@ -708,7 +708,7 @@ static int submit_coredump(
                 coredump_filename = strjoina("COREDUMP_FILENAME=", filename);
                 IOVEC_SET_STRING(iovec[n_iovec++], coredump_filename);
         } else if (arg_storage == COREDUMP_STORAGE_EXTERNAL)
-                log_info("The core will not be stored: size %zu is greater than %zu (the configured maximum)",
+                log_info("The core will not be stored: size %"PRIu64" is greater than %"PRIu64" (the configured maximum)",
                          coredump_size, arg_external_size_max);
 
         /* Vacuum again, but exclude the coredump we just created */
@@ -738,7 +738,7 @@ static int submit_coredump(
                 else
                         log_warning_errno(r, "Failed to generate stack trace: %m");
         } else
-                log_debug("Not generating stack trace: core size %zu is greater than %zu (the configured maximum)",
+                log_debug("Not generating stack trace: core size %"PRIu64" is greater than %"PRIu64" (the configured maximum)",
                           coredump_size, arg_process_size_max);
 
         if (!core_message)
@@ -765,7 +765,7 @@ log:
                         } else
                                 log_warning_errno(r, "Failed to attach the core to the journal entry: %m");
                 } else
-                        log_info("The core will not be stored: size %zu is greater than %zu (the configured maximum)",
+                        log_info("The core will not be stored: size %"PRIu64" is greater than %"PRIu64" (the configured maximum)",
                                  coredump_size, arg_journal_size_max);
         }
 
index cc4dad946556d02c32b5c85088b342fd0db0c0d8..778bee9b12956e3a818703da6ae8b4882804dd94 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "alloc-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "macro.h"
 #include "stacktrace.h"
 #include "string-util.h"
index 6848662ccb1c83808d120fe2cc02dd373bb7fa10..04de75475d148768eecb8849202b4235d71c4fe9 100644 (file)
@@ -355,6 +355,21 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch
         }
 }
 
+static int should_skip_prefix(const char* p) {
+#ifdef HAVE_SPLIT_USR
+        int r;
+        _cleanup_free_ char *target = NULL;
+
+        r = chase_symlinks(p, NULL, &target);
+        if (r < 0)
+                return r;
+
+        return !streq(p, target) && nulstr_contains(prefixes, target);
+#else
+        return 0;
+#endif
+}
+
 static int process_suffix(const char *suffix, const char *onlyprefix) {
         const char *p;
         char *f;
@@ -382,6 +397,15 @@ static int process_suffix(const char *suffix, const char *onlyprefix) {
 
         NULSTR_FOREACH(p, prefixes) {
                 _cleanup_free_ char *t = NULL;
+                int skip;
+
+                skip = should_skip_prefix(p);
+                if (skip < 0) {
+                        r = skip;
+                        goto finish;
+                }
+                if (skip)
+                        continue;
 
                 t = strjoin(p, "/", suffix);
                 if (!t) {
@@ -459,6 +483,13 @@ static int process_suffix_chop(const char *arg) {
         /* Strip prefix from the suffix */
         NULSTR_FOREACH(p, prefixes) {
                 const char *suffix;
+                int skip;
+
+                skip = should_skip_prefix(p);
+                if (skip < 0)
+                        return skip;
+                if (skip)
+                        continue;
 
                 suffix = startswith(arg, p);
                 if (suffix) {
index e64d5bb2315266662053e7315dd48e3efee48791..52cde493e5e0c4eb4c6bc5e9828b91a86dbe8e9c 100644 (file)
@@ -429,10 +429,10 @@ static int add_automount(
                 "Documentation=man:systemd-gpt-auto-generator(8)\n"
                 "[Automount]\n"
                 "Where=%s\n"
-                "TimeoutIdleSec=%lld\n",
+                "TimeoutIdleSec="USEC_FMT"\n",
                 description,
                 where,
-                (unsigned long long)timeout / USEC_PER_SEC);
+                timeout / USEC_PER_SEC);
 
         r = fflush_and_check(f);
         if (r < 0)
index 41b2237d1699a44d289308cf0bac4213b3b57dfc..6aeb5ad6148980db297e69ad1dfca88e027962e2 100644 (file)
@@ -31,7 +31,7 @@
 #include "bus-util.h"
 #include "def.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "initreq.h"
 #include "list.h"
 #include "log.h"
index 42880cca76be35276cb4d2a78fc7151172454495..371b6acc64e74413ab630e1d0ee38cde7e5ab620 100644 (file)
@@ -30,7 +30,7 @@
 #include "def.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "glob-util.h"
 #include "journal-upload.h"
 #include "log.h"
index 3a9fba42a37d1172ca7edf546278313502513dd3..5126c2160eb527fcd408485256f9eaa8878a2a3b 100644 (file)
@@ -24,7 +24,7 @@
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "io-util.h"
 #include "journald-console.h"
 #include "journald-server.h"
index f64abdd43199d346056da537006372eb1f4cdd2b..18c86445074b30f042d226b543dfd25203fc2e87 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "escape.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "io-util.h"
 #include "journald-kmsg.h"
 #include "journald-server.h"
index dee153a4cfe341d974204256fa03c24d1b089019..567f06515f08a317cd1d5881d8536d129c5c54ad 100644 (file)
@@ -40,7 +40,7 @@
 #include "extract-word.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "hashmap.h"
 #include "hostname-util.h"
index 0609b4b6947014db34025c21f6977e725fd5514f..896303fb8544acae1cae15e63a568065e3387429 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "alloc-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "io-util.h"
 #include "journald-console.h"
 #include "journald-kmsg.h"
index d857ff8d39a2db87f7857e04c631f07ab5fa1355..bfe53ce39d3c7c2d62aac49151b3ffe8182d0ca8 100644 (file)
@@ -18,7 +18,7 @@
 ***/
 
 #include "alloc-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "journald-server.h"
 #include "journald-wall.h"
 #include "process-util.h"
index 7f47ca22ddc7b1ae3b09285d2eeab2f988daac19..fc26ef17854cfa8b2442b569127ca0b2fd7cb492 100644 (file)
@@ -22,7 +22,7 @@
 #include "sd-daemon.h"
 #include "sd-messages.h"
 
-#include "formats-util.h"
+#include "format-util.h"
 #include "journal-authenticate.h"
 #include "journald-kmsg.h"
 #include "journald-server.h"
index 47c77b1ba96562af26fbd5e9239eea10e3abbc8d..56257c41d4221f1cd66879d30e966434a1cf218e 100644 (file)
@@ -35,7 +35,7 @@
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "hashmap.h"
 #include "hostname-util.h"
index e8f79507ea65c3a958f3fe73b05704ce948ac024..7e6d4999cb67e130a5270a63e05f1812651b973f 100644 (file)
@@ -7,7 +7,7 @@
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
-libdir=@libdir@
+libdir=@rootlibdir@
 includedir=@includedir@
 
 Name: systemd
index 52128e7b5ce321939855f7e547bef6f5321d6fae..9e58ffbd88c1b8fe280788aa78e8c8009771e3e6 100644 (file)
@@ -264,7 +264,7 @@ static int kernel_get_list(sd_bus *bus, uint64_t flags, char ***x) {
                 if ((flags & KDBUS_LIST_UNIQUE) && name->id != previous_id && !(name->flags & KDBUS_HELLO_ACTIVATOR)) {
                         char *n;
 
-                        if (asprintf(&n, ":1.%llu", (unsigned long long) name->id) < 0) {
+                        if (asprintf(&n, ":1.%llu", name->id) < 0) {
                                 r = -ENOMEM;
                                 goto fail;
                         }
@@ -711,7 +711,7 @@ int bus_get_name_creds_kdbus(
         }
 
         if (mask & SD_BUS_CREDS_UNIQUE_NAME) {
-                if (asprintf(&c->unique_name, ":1.%llu", (unsigned long long) conn_info->id) < 0) {
+                if (asprintf(&c->unique_name, ":1.%llu", conn_info->id) < 0) {
                         r = -ENOMEM;
                         goto fail;
                 }
index c4f693dee9dea8b37b8d5b78301160d78a00de1b..349fa57f2d43022604a4248a791d5e93127b0108 100644 (file)
@@ -30,7 +30,7 @@
 #include "cgroup-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hexdecoct.h"
 #include "parse-util.h"
 #include "process-util.h"
index 21a6b20a116db2fa1214d6e95f190371b982e017..f117c98c11a9e9a3a760d6fb564a54ff310d8e94 100644 (file)
@@ -25,7 +25,7 @@
 #include "cap-list.h"
 #include "capability-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "locale-util.h"
 #include "macro.h"
 #include "string-util.h"
index a3427ca33e0aa6dde2859cc1b8c56b60620fb2d2..c82caeb3fcfba15ba9089f9d174b52c4c3afdfec 100644 (file)
@@ -42,7 +42,7 @@
 #include "capability-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "memfd-util.h"
 #include "parse-util.h"
 #include "stdio-util.h"
@@ -848,8 +848,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
         if (k->src_id == KDBUS_SRC_ID_KERNEL)
                 bus_message_set_sender_driver(bus, m);
         else {
-                xsprintf(m->sender_buffer, ":1.%llu",
-                         (unsigned long long)k->src_id);
+                xsprintf(m->sender_buffer, ":1.%llu", k->src_id);
                 m->sender = m->creds.unique_name = m->sender_buffer;
         }
 
@@ -860,8 +859,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
         else if (k->dst_id == KDBUS_DST_ID_NAME)
                 m->destination = bus->unique_name; /* fill in unique name if the well-known name is missing */
         else {
-                xsprintf(m->destination_buffer, ":1.%llu",
-                         (unsigned long long)k->dst_id);
+                xsprintf(m->destination_buffer, ":1.%llu", k->dst_id);
                 m->destination = m->destination_buffer;
         }
 
@@ -1035,7 +1033,7 @@ int bus_kernel_take_fd(sd_bus *b) {
         b->bloom_size = (size_t) bloom->size;
         b->bloom_n_hash = (unsigned) bloom->n_hash;
 
-        if (asprintf(&b->unique_name, ":1.%llu", (unsigned long long) hello->id) < 0) {
+        if (asprintf(&b->unique_name, ":1.%llu", hello->id) < 0) {
                 r = -ENOMEM;
                 goto fail;
         }
@@ -1207,7 +1205,7 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call
                                         return r;
                         }
                 } else {
-                        log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type);
+                        log_debug("Ignoring message with unknown payload type %llu.", k->payload_type);
                         close_kdbus_msg(bus, k);
                 }
         }
@@ -1268,7 +1266,7 @@ static int translate_name_change(
         if (d->type == KDBUS_ITEM_NAME_ADD || (d->name_change.old_id.flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_ACTIVATOR)))
                 old_owner[0] = 0;
         else
-                sprintf(old_owner, ":1.%llu", (unsigned long long) d->name_change.old_id.id);
+                sprintf(old_owner, ":1.%llu", d->name_change.old_id.id);
 
         if (d->type == KDBUS_ITEM_NAME_REMOVE || (d->name_change.new_id.flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_ACTIVATOR))) {
 
@@ -1277,7 +1275,7 @@ static int translate_name_change(
 
                 new_owner[0] = 0;
         } else
-                sprintf(new_owner, ":1.%llu", (unsigned long long) d->name_change.new_id.id);
+                sprintf(new_owner, ":1.%llu", d->name_change.new_id.id);
 
         return push_name_owner_changed(bus, d->name_change.name, old_owner, new_owner, ts);
 }
@@ -1419,7 +1417,7 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority) {
                 r = bus_kernel_translate_message(bus, k);
                 close_kdbus_msg(bus, k);
         } else {
-                log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type);
+                log_debug("Ignoring message with unknown payload type %llu.", k->payload_type);
                 r = 0;
                 close_kdbus_msg(bus, k);
         }
index cfd775313905a9faa79c1f5c31dd4571f2dbf939..e6ed15eb71d4d97f4c7993db4d601c7abda5ea19 100644 (file)
@@ -30,7 +30,7 @@
 #include "bus-message.h"
 #include "bus-socket.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hexdecoct.h"
 #include "macro.h"
 #include "missing.h"
index fc60830059c441c8ad803d45857d5989346ee6bb..0fc6fc90ed135b1926117434e152d57de3a3d4ce 100644 (file)
@@ -30,7 +30,7 @@
 #include "bus-match.h"
 #include "bus-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "log.h"
 #include "macro.h"
 #include "util.h"
index 3fcefada3f432e8b81ce51c4d95eaf92125b426a..42ea0badfc6a0d6dc269a8cea7ac7a2fa744c3fe 100644 (file)
@@ -31,7 +31,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "hostname-util.h"
 #include "io-util.h"
index c1fd7dd33e4abe544691cb8917d89dba5dac048d..9de33d85dbd1dce83e167df759601e5be809171a 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "alloc-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "string-util.h"
 #include "strv.h"
 #include "util.h"
index df3b3c922e044dcc951115e75be77503b1184fb5..654a22fe3b5c74e1418747930f41def282809a2e 100644 (file)
@@ -24,7 +24,7 @@
 #include "sd-netlink.h"
 
 #include "alloc-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "missing.h"
 #include "netlink-internal.h"
 #include "netlink-types.h"
index c165fa33592710a62c2835023f09977e3f464853..a0fd8a3ac9e58d29711c046979da2d48771f98bb 100644 (file)
@@ -24,7 +24,7 @@
 #include "sd-netlink.h"
 
 #include "alloc-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "missing.h"
 #include "netlink-internal.h"
 #include "netlink-types.h"
index 09240c7b2a0d1c5161784f4497e40738584d829d..b543b5f20cbe09c95290f2ddee5ec1a6a63e57e7 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "sd-netlink.h"
 
-#include "formats-util.h"
+#include "format-util.h"
 #include "missing.h"
 #include "netlink-internal.h"
 #include "netlink-types.h"
index a1f2b33ad5e3ce6f90f51eb7daf8d9a813b6cf46..a40329d732834a6d7b4042092bf4ce441ec7ea62 100644 (file)
@@ -33,7 +33,7 @@
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "libudev-private.h"
 #include "missing.h"
 #include "mount-util.h"
index a0f3f524e0ad82a1a0d0a8c1216046724e623d8e..770c92209ec0ead5e0e615bb2ca5926f81c7f8dc 100644 (file)
@@ -7,7 +7,7 @@
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
-libdir=@libdir@
+libdir=@rootlibdir@
 includedir=@includedir@
 
 Name: libudev
index f2c37a8623ae84f29945fc8bd0424b50773880f9..7e5a0936987af9db86db812aafd56718391d449c 100644 (file)
@@ -29,7 +29,7 @@
 #include "bus-error.h"
 #include "bus-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "process-util.h"
 #include "signal-util.h"
 #include "strv.h"
index 0cef88a82de98501aff137592a9690c3b0d0f6ce..1b69f4b9ca77b449f1abeac11c2f9c7c8e757058 100644 (file)
@@ -25,7 +25,7 @@
 #include "dirent-util.h"
 #include "escape.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "logind-acl.h"
 #include "set.h"
 #include "string-util.h"
index a950409254e0ee4e03d254cdbf411ed085d3b3a6..91225a536374dfad1c8bf3a1ed187f73328bb6ff 100644 (file)
@@ -23,7 +23,7 @@
 #include "bus-error.h"
 #include "bus-util.h"
 #include "conf-parser.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "logind-action.h"
 #include "process-util.h"
 #include "sleep-config.h"
index 0a84d75e249100b91c4c013adc6804f5a4ffd9ef..23ad5d7c6a1d0299d5c482bba1116b60f0949487 100644 (file)
@@ -34,7 +34,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio-label.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "logind.h"
 #include "mkdir.h"
index a7e5c01ef38a16769c5a1584a37a06cfb61c185c..5ca42b1ca2ae2c4d14cc4f73f23e25d181b3112e 100644 (file)
@@ -26,7 +26,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "logind-inhibit.h"
 #include "mkdir.h"
 #include "parse-util.h"
index ecc7bd2e5b9b28b833dd869225a5f342952805cf..f0d8a1f55452c3af65016a21655a18b0e265c89d 100644 (file)
@@ -27,7 +27,7 @@
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "logind-acl.h"
 #include "logind-seat.h"
 #include "mkdir.h"
index e83c37a5ac39773d42fbf7a3516398b926c72dfd..d8bb1ea0a84e603469f672636abff92627e25d38 100644 (file)
@@ -35,7 +35,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "io-util.h"
 #include "logind-session.h"
 #include "mkdir.h"
index af6392e02570ec8ac5a9985f418179ed2a383d88..987c63014f750a598e8ee9b0127740f27e8f53ea 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "alloc-util.h"
 #include "bus-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "logind-user.h"
 #include "logind.h"
 #include "signal-util.h"
index 2dc5fa76658272d283985a93cc378ae63737585d..0d1417ea16151014c2c9f453c93a699f7fae2d10 100644 (file)
@@ -32,7 +32,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "hashmap.h"
 #include "label.h"
index 29ab00eb1f7d1e34379c6972aaca420536ff15d5..311751c2db2035d1d8691dff71661c1d2f492e5d 100644 (file)
@@ -29,7 +29,7 @@
 #include "bus-common-errors.h"
 #include "bus-error.h"
 #include "bus-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "logind.h"
 #include "special.h"
 #include "strv.h"
index a9841a3832e69ef011fb27ea844f6182ac418847..19bae294a4a22aee0ff51ae0569cf19c50b3e709 100644 (file)
@@ -32,7 +32,7 @@
 #include "def.h"
 #include "dirent-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "logind.h"
 #include "selinux-util.h"
 #include "signal-util.h"
index b0f75b2a21c4941ec8fd5f81c11b55eb533bb1b1..dab082a26ee9269f69b8d895bdef72c13a090553 100644 (file)
@@ -36,7 +36,7 @@
 #include "def.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hostname-util.h"
 #include "login-util.h"
 #include "macro.h"
index 5ca18ff87e88c16c07d5f99c6114b3ee297ad36f..28e4867cb32abc8c4d3619c6937bc2c5822a6fd5 100644 (file)
@@ -37,7 +37,7 @@
 #include "env-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "in-addr-util.h"
 #include "local-addresses.h"
index 9e7b6cc03dd2116284d8df62e22f0b5beaa3e492..eb4b35d52a5e298e595825bc7baada19e6261551 100644 (file)
@@ -30,7 +30,7 @@
 #include "extract-word.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hashmap.h"
 #include "machine-dbus.h"
 #include "machine.h"
index 7b9be3b425820a2628eaf177a0ae6126f1844311..9c754b43278c2879a87fe314ae8ea1e5d25b5172 100644 (file)
@@ -330,10 +330,12 @@ static int list_machines(int argc, char *argv[], void *userdata) {
                         printf("-\n");
         }
 
-        if (arg_legend && n_machines > 0)
-                printf("\n%zu machines listed.\n", n_machines);
-        else
-                printf("No machines.\n");
+        if (arg_legend) {
+                if (n_machines > 0)
+                        printf("\n%zu machines listed.\n", n_machines);
+                else
+                        printf("No machines.\n");
+        }
 
 out:
         clean_machine_info(machines, n_machines);
@@ -463,10 +465,12 @@ static int list_images(int argc, char *argv[], void *userdata) {
                        (int) max_mtime, strna(format_timestamp(mtime_buf, sizeof(mtime_buf), images[j].mtime)));
         }
 
-        if (arg_legend && n_images > 0)
-                printf("\n%zu images listed.\n", n_images);
-        else
-                printf("No images.\n");
+        if (arg_legend) {
+                if (n_images > 0)
+                        printf("\n%zu images listed.\n", n_images);
+                else
+                        printf("No images.\n");
+        }
 
         return 0;
 }
@@ -2489,10 +2493,12 @@ static int list_transfers(int argc, char *argv[], void *userdata) {
                        (int) max_local, transfers[j].local,
                        (int) max_remote, transfers[j].remote);
 
-        if (arg_legend && n_transfers > 0)
-                printf("\n%zu transfers listed.\n", n_transfers);
-        else
-                printf("No transfers.\n");
+        if (arg_legend) {
+                if (n_transfers > 0)
+                        printf("\n%zu transfers listed.\n", n_transfers);
+                else
+                        printf("No transfers.\n");
+        }
 
         return 0;
 }
index e40f40a263374e799bd683a1973bc6b5ec44baff..3ee3938ebb779f3b7d4f9bb9aae7a6c01fcdb655 100644 (file)
@@ -30,7 +30,7 @@
 #include "cgroup-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hostname-util.h"
 #include "image-dbus.h"
 #include "io-util.h"
index 57121945f3d93100ce94e9c89aae73a82175d542..8719e01de92d3cf979a3ed2a2bffc3e230b06a3c 100644 (file)
@@ -29,7 +29,7 @@
 #include "cgroup-util.h"
 #include "dirent-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hostname-util.h"
 #include "label.h"
 #include "machine-image.h"
index 042232fcac6d4e14732f4b84aa85150b911079e9..0dc00e874d42deaf0239816b9eb491757715ce8c 100644 (file)
@@ -1003,7 +1003,7 @@ int config_parse_dns(
                 union in_addr_union a;
                 int family;
 
-                r = extract_first_word(&rvalue, &w, WHITESPACE, EXTRACT_QUOTES|EXTRACT_RETAIN_ESCAPE);
+                r = extract_first_word(&rvalue, &w, NULL, EXTRACT_QUOTES|EXTRACT_RETAIN_ESCAPE);
                 if (r == 0)
                         break;
                 if (r == -ENOMEM)
index 49f97c61d983d65e044eaef7f3c7a5d2c9687a63..70b6f868b994c0a5762b76b2fd8c5320b6ac73d1 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "alloc-util.h"
 #include "env-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "log.h"
 #include "parse-util.h"
 #include "string-util.h"
index 392498d1bb7a7655e21e6da9cb994201c2c8f234..0c24b8e18ac54da2bc63e1eb07eef9fd85c64e2b 100644 (file)
@@ -429,7 +429,7 @@ int mount_all(const char *dest,
                                 o = options;
                 }
 
-                r = mount_verbose(mount_table[k].fatal ? LOG_ERR : LOG_WARNING,
+                r = mount_verbose(mount_table[k].fatal ? LOG_ERR : LOG_DEBUG,
                                   mount_table[k].what,
                                   where,
                                   mount_table[k].type,
index 673e61691195fde8d2dfb456779c74159c0480f8..c8b18bcb88c565ea5ee099c4912cac0e8bfd9e11 100644 (file)
@@ -57,7 +57,7 @@
 #include "fd-util.h"
 #include "fdset.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "gpt.h"
 #include "hostname-util.h"
@@ -4033,7 +4033,7 @@ int main(int argc, char *argv[]) {
         bool root_device_rw = true, home_device_rw = true, srv_device_rw = true;
         _cleanup_close_ int master = -1, image_fd = -1;
         _cleanup_fdset_free_ FDSet *fds = NULL;
-        int r, n_fd_passed, loop_nr = -1, ret = EXIT_FAILURE;
+        int r, n_fd_passed, loop_nr = -1, ret = EXIT_SUCCESS;
         char veth_name[IFNAMSIZ] = "";
         bool secondary = false, remove_subvol = false;
         pid_t pid = 0;
index 8f1cc9e2e3913a51d470661246e61380b9cab545..99f03465b061f0cfd5279b38feb789ed30a74313 100644 (file)
@@ -30,7 +30,7 @@
 #include "calendarspec.h"
 #include "env-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "process-util.h"
index 2aa951fce98d10c03acee49255b3b4987ba0e95c..79a3b9591d511bdf0f476bfdc46ae72004c7072a 100644 (file)
@@ -162,7 +162,7 @@ int add_base_acls_if_needed(acl_t *acl_p, const char *path) {
 
 int acl_search_groups(const char *path, char ***ret_groups) {
         _cleanup_strv_free_ char **g = NULL;
-        _cleanup_(acl_free) acl_t acl = NULL;
+        _cleanup_(acl_freep) acl_t acl = NULL;
         bool ret = false;
         acl_entry_t entry;
         int r;
index 2597cfc6486af048f15dd8cac5eb756efa65471c..3e877920da96174402f2b25616ca3920c1790c26 100644 (file)
@@ -43,7 +43,7 @@
 #include "ask-password-api.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "io-util.h"
 #include "log.h"
 #include "macro.h"
index 4db6cefb6e1159e144cd937476128223f9f90ce5..5d21742a096b968de6ffbdc24625384b7bad9fa7 100644 (file)
@@ -28,7 +28,7 @@
 #include "cgroup-show.h"
 #include "cgroup-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "locale-util.h"
 #include "macro.h"
 #include "output-mode.h"
index d5db604f031a82096565d720050d6c347c633d27..f2d1555c132c6f806b2ee40f32b812272d8401b3 100644 (file)
@@ -36,7 +36,7 @@
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "log.h"
 #include "macro.h"
 #include "string-util.h"
index 19a371c865a288e6b2d67b17f3c571ee6340cce0..265ac83dc0b88170f86762ff931ff88eb547390b 100644 (file)
@@ -781,7 +781,7 @@ int config_parse_strv(const char *unit,
         for (;;) {
                 char *word = NULL;
 
-                r = extract_first_word(&rvalue, &word, WHITESPACE, EXTRACT_QUOTES|EXTRACT_RETAIN_ESCAPE);
+                r = extract_first_word(&rvalue, &word, NULL, EXTRACT_QUOTES|EXTRACT_RETAIN_ESCAPE);
                 if (r == 0)
                         break;
                 if (r == -ENOMEM)
index 007c632f3592b066ccaa60904137f05914b17d5a..823fb61cdadc3dc9f55c6f007dc4cfd89ad6c949 100644 (file)
@@ -22,7 +22,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "formats-util.h"
+#include "format-util.h"
 #include "install-printf.h"
 #include "install.h"
 #include "macro.h"
index f9d9c4ed62a088d8e8653cf711308d81202ea670..75ea25c8ac05977a9b9b7418f1e1cde46bb0f49b 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "alloc-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hashmap.h"
 #include "hostname-util.h"
 #include "io-util.h"
@@ -223,10 +223,7 @@ static int output_timestamp_monotonic(FILE *f, sd_journal *j, const char *monoto
         if (r < 0)
                 return log_error_errno(r, "Failed to get monotonic timestamp: %m");
 
-        fprintf(f, "[%5llu.%06llu]",
-                (unsigned long long) (t / USEC_PER_SEC),
-                (unsigned long long) (t % USEC_PER_SEC));
-
+        fprintf(f, "[%5"PRI_USEC".%06"PRI_USEC"]", t / USEC_PER_SEC, t % USEC_PER_SEC);
         return 1 + 5 + 1 + 6 + 1;
 }
 
@@ -268,7 +265,7 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou
                 switch (mode) {
 
                 case OUTPUT_SHORT_UNIX:
-                        xsprintf(buf, "%10llu.%06llu", (unsigned long long) t, (unsigned long long) (x % USEC_PER_SEC));
+                        xsprintf(buf, "%10"PRI_TIME".%06"PRIu64, t, x % USEC_PER_SEC);
                         break;
 
                 case OUTPUT_SHORT_ISO:
@@ -292,7 +289,7 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou
                                 assert(sizeof(buf) > strlen(buf));
                                 k = sizeof(buf) - strlen(buf);
 
-                                r = snprintf(buf + strlen(buf), k, ".%06llu", (unsigned long long) (x % USEC_PER_SEC));
+                                r = snprintf(buf + strlen(buf), k, ".%06"PRIu64, x % USEC_PER_SEC);
                                 if (r <= 0 || (size_t) r >= k) { /* too long? */
                                         log_error("Failed to format precise time");
                                         return -EINVAL;
@@ -418,7 +415,7 @@ static int output_short(
 
         if (flags & OUTPUT_NO_HOSTNAME) {
                 /* Suppress display of the hostname if this is requested. */
-                hostname = NULL;
+                hostname = mfree(hostname);
                 hostname_len = 0;
         }
 
index 9e723b02619c40c3554d965898465b83189e68b9..af5b18c0ed15fafbeb9b47b7b3c3578a8189a023 100644 (file)
@@ -50,7 +50,7 @@
 #include "exit-status.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "glob-util.h"
 #include "hostname-util.h"
index 0684f58fcd099568e31c5e29137ed06433d73a94..17b966eb5266ad0de67c10e69c878477e8d7eb1d 100644 (file)
@@ -30,7 +30,7 @@
 #include "def.h"
 #include "fd-util.h"
 #include "fileio-label.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hashmap.h"
 #include "path-util.h"
 #include "selinux-util.h"
index c24c784e9be811d277332f7c73319bbf57096b8c..c60fb631fad9923678f0a7b3e07c73fd7619d20a 100644 (file)
@@ -21,7 +21,7 @@
 #include "cgroup-util.h"
 #include "dirent-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "parse-util.h"
 #include "process-util.h"
 #include "stat-util.h"
index 55a2f9d23b9dcda7f028083725eec84c181d0cd8..ae9e113efba739e2274088137f517a1a571f13b0 100644 (file)
@@ -20,7 +20,7 @@
 #include <stddef.h>
 #include <unistd.h>
 
-#include "formats-util.h"
+#include "format-util.h"
 #include "log.h"
 #include "util.h"
 
index d0f84d70bcdaa29bc64c57dfc8bea73a910f3847..e43373b0f5967c845fc9a698c16fdcbeb35d2c93 100644 (file)
@@ -232,21 +232,25 @@ static void test_foreach_word(void) {
 }
 
 static void check(const char *test, char** expected, bool trailing) {
-        const char *word, *state;
-        size_t l;
-        int i = 0;
+        int i = 0, r;
 
         printf("<<<%s>>>\n", test);
-        FOREACH_WORD_QUOTED(word, l, test, state) {
-                _cleanup_free_ char *t = NULL;
-
-                assert_se(t = strndup(word, l));
-                assert_se(strneq(expected[i++], word, l));
-                printf("<%s>\n", t);
+        for (;;) {
+                _cleanup_free_ char *word = NULL;
+
+                r = extract_first_word(&test, &word, NULL, EXTRACT_QUOTES);
+                if (r == 0) {
+                        assert_se(!trailing);
+                        break;
+                } else if (r < 0) {
+                        assert_se(trailing);
+                        break;
+                }
+
+                assert_se(streq(word, expected[i++]));
+                printf("<%s>\n", word);
         }
-        printf("<<<%s>>>\n", state);
         assert_se(expected[i] == NULL);
-        assert_se(isempty(state) == !trailing);
 }
 
 static void test_foreach_word_quoted(void) {
index f35e6793b78bec8df52e962841a8c8edff8d1c9d..a7c86d155a969d08b8b260fae393732b441309ed 100644 (file)
@@ -25,7 +25,7 @@
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "log.h"
 #include "string-util.h"
index d5e16db3a036a4904f43f093fdea9ddbb824b90b..a455652a27ffc15bfdf4c6961343c4e3bb096686 100644 (file)
@@ -376,12 +376,12 @@ static int manager_adjust_clock(Manager *m, double offset, int leap_sec) {
         m->drift_ppm = tmx.freq / 65536;
 
         log_debug("  status       : %04i %s\n"
-                  "  time now     : %li.%03llu\n"
+                  "  time now     : %li.%03"PRI_USEC"\n"
                   "  constant     : %li\n"
                   "  offset       : %+.3f sec\n"
                   "  freq offset  : %+li (%i ppm)\n",
                   tmx.status, tmx.status & STA_UNSYNC ? "unsync" : "sync",
-                  tmx.time.tv_sec, (unsigned long long) (tmx.time.tv_usec / NSEC_PER_MSEC),
+                  tmx.time.tv_sec, tmx.time.tv_usec / NSEC_PER_MSEC,
                   tmx.constant,
                   (double)tmx.offset / NSEC_PER_SEC,
                   tmx.freq, m->drift_ppm);
index 97a564d5a2d66898b81bdcbbd391868503576627..b881d774a0ece70e23755d2449d8250720634762 100644 (file)
@@ -47,7 +47,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "glob-util.h"
 #include "io-util.h"
index 7717ac7924aa2b36fe8c67442c60fcbbd0fbe903..dbefbbe175da06ba52ab93a9e0c43b43a892687a 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "alloc-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "socket-util.h"
 #include "udev.h"
 
index 54cd741bb165cd0debcb7ba8abbbe232e197a48d..304a28777b4bbe27110bbed2b140fce173c232fa 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "alloc-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "netlink-util.h"
 #include "process-util.h"
 #include "signal-util.h"
index 43004bc0bcca6e1dd35caa74156af928e3d6fdf1..e94a8143887092d86e5fbf0db97bc2f2231ffe3e 100644 (file)
@@ -25,7 +25,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "selinux-util.h"
 #include "smack-util.h"
index f656c2198e7dd3541b46ca50f8ed3fb936e156eb..f6318343415150369cc8335ca6d32775e9b3415f 100644 (file)
@@ -26,7 +26,7 @@
 #include <time.h>
 
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "udev-util.h"
 #include "udev.h"
 
index badbab62057e8075f0317aa92e3320a699ea650a..d336ee003c27c3429e0dcc57da784df1bbf4e8cb 100644 (file)
@@ -49,7 +49,7 @@
 #include "dev-setup.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "hashmap.h"
 #include "io-util.h"
index a8efe8e91faa05ede8665bf293eb6f8ea799224a..ae9859ccadd88821a792ca1f6831c7fa3eb84b63 100644 (file)
@@ -30,7 +30,7 @@
 #include "alloc-util.h"
 #include "bus-error.h"
 #include "bus-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "log.h"
 #include "macro.h"
 #include "special.h"
index fa6cf4181a124e0adcf422f95621faf99e4a21a6..48926290a673a2810fa7053b194a4fff109a1519 100755 (executable)
@@ -68,7 +68,7 @@ START_SEC=$(date -u '+%s')
 systemctl start --wait wait2.service || exit 1
 END_SEC=$(date -u '+%s')
 ELAPSED=$(($END_SEC-$START_SEC))
-[[ "$ELAPSED" -ge 2 ]] && [[ "$ELAPSED" -le 3 ]] || exit 1
+[[ "$ELAPSED" -ge 2 ]] && [[ "$ELAPSED" -le 4 ]] || exit 1
 
 # wait5fail fails, so systemctl should fail
 START_SEC=$(date -u '+%s')