summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/dbus-common.h1
-rw-r--r--src/shared/util.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h
index a9a4dcca6b..bcbf18ffab 100644
--- a/src/shared/dbus-common.h
+++ b/src/shared/dbus-common.h
@@ -23,6 +23,7 @@
#include <dbus/dbus.h>
#include <inttypes.h>
+#include <sys/types.h>
#ifndef DBUS_ERROR_UNKNOWN_OBJECT
#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject"
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;