1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

fs-util: use path_extract_filename() at one more place

This commit is contained in:
Yu Watanabe 2022-04-15 13:33:43 +09:00
parent 3e02a6a33e
commit ce8394f9c7

View File

@ -156,24 +156,16 @@ int readlink_malloc(const char *p, char **ret) {
int readlink_value(const char *p, char **ret) {
_cleanup_free_ char *link = NULL;
char *value;
int r;
assert(p);
assert(ret);
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;
return path_extract_filename(link, ret);
}
int readlink_and_make_absolute(const char *p, char **r) {