diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-23 16:53:39 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-26 14:08:46 +0100 |
commit | 3ebc048b6bd8cb34b5d570d5817770d5817396a0 (patch) | |
tree | 24158e1cbc006738084b00441f4d6a2071340074 /src/basic/terminal-util.c | |
parent | b48a0e095642a1586bea839cb2fa28023473b49e (diff) | |
download | systemd-3ebc048b6bd8cb34b5d570d5817770d5817396a0.tar.gz |
terminal-util: use PATH_STARTSWITH_SET() instead of plain startswith() where appropriate
After all, we deal with paths here.
Diffstat (limited to 'src/basic/terminal-util.c')
-rw-r--r-- | src/basic/terminal-util.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 7fce84bf82..a5e4de00b0 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -1014,11 +1014,8 @@ int get_ctty(pid_t pid, dev_t *_devnr, char **r) { return -ENOMEM; } } else { - if (startswith(s, "/dev/")) - p = s + 5; - else if (startswith(s, "../")) - p = s + 3; - else + p = PATH_STARTSWITH_SET(s, "/dev/", "../"); + if (!p) p = s; b = strdup(p); |