]> git.proxmox.com Git - systemd.git/commitdiff
Cherry-pick Shared-add-readlink_value.patch
authorDidier Roche <didrocks@ubuntu.com>
Thu, 27 Nov 2014 12:13:17 +0000 (13:13 +0100)
committerMartin Pitt <martin.pitt@ubuntu.com>
Fri, 28 Nov 2014 10:22:23 +0000 (11:22 +0100)
We will use that function in the generator.

debian/changelog
debian/patches/series
debian/patches/shared-add-readlink_value.patch [new file with mode: 0644]

index bd6c3f3ca3009eed95be2345b90abcd9f6c477af..eb6223436d98bb9454d9a526288ec6904d06b50e 100644 (file)
@@ -1,3 +1,10 @@
+systemd (215-8) UNRELEASED; urgency=medium
+
+  * Cherry-pick shared-add-readlink_value.patch, we will use that function in
+    the generator.
+
+ -- Didier Roche <didrocks@ubuntu.com>  Fri, 28 Nov 2014 08:50:35 +0100
+
 systemd (215-7) unstable; urgency=medium
 
   [ Martin Pitt ]
index 79f7bdceb1ff563f57a63a1e530b0140939e90f4..852c77df89286570a1962680b3b9450c6de1f0a6 100644 (file)
@@ -118,6 +118,7 @@ core-swap-follow-the-configured-unit-by-default.patch
 core-swap-advertise-Discard-over-dbus.patch
 core-swap-only-make-configured-units-part-of-swap.ta.patch
 swap-replace-Discard-setting-by-a-more-generic-Optio.patch
+shared-add-readlink_value.patch
 
 ## Debian specific patches:
 Add-back-support-for-Debian-specific-config-files.patch
diff --git a/debian/patches/shared-add-readlink_value.patch b/debian/patches/shared-add-readlink_value.patch
new file mode 100644 (file)
index 0000000..f589ad2
--- /dev/null
@@ -0,0 +1,55 @@
+From: Tom Gundersen <teg@jklm.no>
+Date: Fri, 7 Nov 2014 19:19:02 +0100
+Subject: shared: add readlink_value
+
+Reads the basename of the target of a symlink.
+---
+ src/shared/util.c | 22 ++++++++++++++++++++++
+ src/shared/util.h |  1 +
+ 2 files changed, 23 insertions(+)
+
+diff --git a/src/shared/util.c b/src/shared/util.c
+index 4143f6d..1b3bbeb 100644
+--- a/src/shared/util.c
++++ b/src/shared/util.c
+@@ -893,6 +893,28 @@ int readlink_malloc(const char *p, char **ret) {
+         return readlinkat_malloc(AT_FDCWD, p, ret);
+ }
++int readlink_value(const char *p, char **ret) {
++        _cleanup_free_ char *link = NULL;
++        char *value;
++        int r;
++
++        r = readlink_malloc(p, &link);
++        if (r < 0)
++                return r;
++
++        value = basename(link);
++        if (!value)
++                return -ENOENT;
++
++        value = strdup(value);
++        if (!value)
++                return -ENOMEM;
++
++        *ret = value;
++
++        return 0;
++}
++
+ int readlink_and_make_absolute(const char *p, char **r) {
+         _cleanup_free_ char *target = NULL;
+         char *k;
+diff --git a/src/shared/util.h b/src/shared/util.h
+index 3558446..f928034 100644
+--- a/src/shared/util.h
++++ b/src/shared/util.h
+@@ -270,6 +270,7 @@ char **replace_env_argv(char **argv, char **env);
+ int readlinkat_malloc(int fd, const char *p, char **ret);
+ int readlink_malloc(const char *p, char **r);
++int readlink_value(const char *p, char **ret);
+ int readlink_and_make_absolute(const char *p, char **r);
+ int readlink_and_canonicalize(const char *p, char **r);