summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 9ec6e2fe2f..d01c2061b4 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2869,7 +2869,8 @@ int get_ctty(pid_t pid, dev_t *_devnr, char **r) {
snprintf(fn, sizeof(fn), "/dev/char/%u:%u", major(devnr), minor(devnr));
char_array_0(fn);
- if ((k = readlink_malloc(fn, &s)) < 0) {
+ k = readlink_malloc(fn, &s);
+ if (k < 0) {
if (k != -ENOENT)
return k;
@@ -2890,7 +2891,8 @@ int get_ctty(pid_t pid, dev_t *_devnr, char **r) {
* symlink in /dev/char. Let's return something
* vaguely useful. */
- if (!(b = strdup(fn + 5)))
+ b = strdup(fn + 5);
+ if (!b)
return -ENOMEM;
*r = b;