diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-06-25 00:24:23 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-06-25 01:31:26 +0900 |
commit | 270384b2d494bd1f53242c923f875ccfdf6e214d (patch) | |
tree | 66b619dc3c5e218b9ac87b5034d807a78fda5cb7 /src/libsystemd | |
parent | 2d9b74ba87a3fef313f362460d5d9a4283548ff6 (diff) | |
download | systemd-270384b2d494bd1f53242c923f875ccfdf6e214d.tar.gz |
tree-wide: replace strjoina() with prefix_roota()
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-device/device-private.c | 5 | ||||
-rw-r--r-- | src/libsystemd/sd-device/sd-device.c | 7 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c index a0855001e3..731b0ed0a7 100644 --- a/src/libsystemd/sd-device/device-private.c +++ b/src/libsystemd/sd-device/device-private.c @@ -609,8 +609,7 @@ void device_set_watch_handle(sd_device *device, int handle) { int device_rename(sd_device *device, const char *name) { _cleanup_free_ char *dirname = NULL; - char *new_syspath; - const char *interface; + const char *new_syspath, *interface; int r; assert(device); @@ -620,7 +619,7 @@ int device_rename(sd_device *device, const char *name) { if (!dirname) return -ENOMEM; - new_syspath = strjoina(dirname, "/", name); + new_syspath = prefix_roota(dirname, name); /* the user must trust that the new name is correct */ r = device_set_syspath(device, new_syspath, false); diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index 773be6ae1e..d0f8417807 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -1735,8 +1735,7 @@ static int device_get_sysattr_value(sd_device *device, const char *_key, const c * with a NULL value in the cache, otherwise the returned string is stored */ _public_ int sd_device_get_sysattr_value(sd_device *device, const char *sysattr, const char **_value) { _cleanup_free_ char *value = NULL; - const char *syspath, *cached_value = NULL; - char *path; + const char *path, *syspath, *cached_value = NULL; struct stat statbuf; int r; @@ -1763,7 +1762,7 @@ _public_ int sd_device_get_sysattr_value(sd_device *device, const char *sysattr, if (r < 0) return r; - path = strjoina(syspath, "/", sysattr); + path = prefix_roota(syspath, sysattr); r = lstat(path, &statbuf); if (r < 0) { /* remember that we could not access the sysattr */ @@ -1838,7 +1837,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, if (r < 0) return r; - path = strjoina(syspath, "/", sysattr); + path = prefix_roota(syspath, sysattr); len = strlen(_value); |