summaryrefslogtreecommitdiffstats
path: root/src/basic/terminal-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-11-23 16:53:39 +0100
committerLennart Poettering <lennart@poettering.net>2018-11-26 14:08:46 +0100
commit3ebc048b6bd8cb34b5d570d5817770d5817396a0 (patch)
tree24158e1cbc006738084b00441f4d6a2071340074 /src/basic/terminal-util.c
parentjournal-upload: use static initialization (diff)
downloadsystemd-3ebc048b6bd8cb34b5d570d5817770d5817396a0.tar.xz
systemd-3ebc048b6bd8cb34b5d570d5817770d5817396a0.zip
terminal-util: use PATH_STARTSWITH_SET() instead of plain startswith() where appropriate
After all, we deal with paths here.
Diffstat (limited to '')
-rw-r--r--src/basic/terminal-util.c7
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);