aboutsummaryrefslogtreecommitdiffstats
path: root/kbd.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-03-03 10:29:42 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-03-03 10:29:42 +0100
commit6629a1b23f31018caecf2d56d9f8bb1052e1c140 (patch)
tree73f0a01f13b6ba3290015706c5c278eed00f5eb3 /kbd.c
parentc5eb4d56d6e2bb6942fea1bbbcc0cc988a903710 (diff)
downloadfbida-6629a1b23f31018caecf2d56d9f8bb1052e1c140.tar.gz
fbcon: sd_bus_message_read fix
Diffstat (limited to 'kbd.c')
-rw-r--r--kbd.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/kbd.c b/kbd.c
index d756401..ddbce01 100644
--- a/kbd.c
+++ b/kbd.c
@@ -246,7 +246,7 @@ int logind_open(const char *path)
sd_bus_message *m = NULL;
struct stat st;
unsigned int maj, min;
- bool inactive;
+ int inactive;
int handle, fd, r;
r = stat(path, &st);
@@ -274,20 +274,18 @@ int logind_open(const char *path)
}
handle = -1;
+ inactive = -1;
r = sd_bus_message_read(m, "hb", &handle, &inactive);
if (r < 0) {
fprintf(stderr, "Parsing TakeDevice reply failed: %s\n", strerror(-r));
fd = -1;
- } else if (handle < 0) {
- fprintf(stderr, "Huh? handle is %d\n", handle);
- fd = -1;
} else {
- fd = dup(handle);
+ fd = fcntl(handle, F_DUPFD_CLOEXEC, 0);
}
sd_bus_message_unref(m);
- fprintf(stderr, "open %s: got fd %d via logind (handle %d, inactive %s).\n",
- path, fd, handle, inactive ? "true" : "false");
+ fprintf(stderr, "open %s: got fd %d via logind.\n",
+ path, fd, handle, inactive);
return fd;
}