diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2024-03-19 18:27:04 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2024-03-20 15:13:44 +0100 |
commit | 454318d3e86c125a78e61a825d84db1b52c1a4a9 (patch) | |
tree | ec46d6c3506a588343a050823b796c1c828274f8 /src/basic/chase.c | |
parent | test-cgroup-util: reduce scope of iterator variables (diff) | |
download | systemd-454318d3e86c125a78e61a825d84db1b52c1a4a9.tar.xz systemd-454318d3e86c125a78e61a825d84db1b52c1a4a9.zip |
various: use strdup_to() in various obvious cases
strdup_to() returns 0 on success and here we convert obvious blocks
which either return -ENOMEM or 0.
Diffstat (limited to 'src/basic/chase.c')
-rw-r--r-- | src/basic/chase.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/basic/chase.c b/src/basic/chase.c index 9f5477e4f3..245dd0800e 100644 --- a/src/basic/chase.c +++ b/src/basic/chase.c @@ -741,12 +741,7 @@ int chase_extract_filename(const char *path, const char *root, char **ret) { return r; } - char *fname = strdup("."); - if (!fname) - return -ENOMEM; - - *ret = fname; - return 0; + return strdup_to(ret, "."); } int chase_and_open(const char *path, const char *root, ChaseFlags chase_flags, int open_flags, char **ret_path) { |