diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-12-23 22:32:48 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-12-24 00:29:40 +0100 |
commit | 23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0 (patch) | |
tree | 5175b16d46a7dfe59afaf2c8dd85f1b4081f7979 /src/shared/util.c | |
parent | 0ad1271f564b9c956685938167f7ea8c301e835e (diff) |
logind: add support for automatic suspend/hibernate/shutdown on idle
Diffstat (limited to 'src/shared/util.c')
-rw-r--r-- | src/shared/util.c | 6 |
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; |