diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-03 10:29:42 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-03 10:29:42 +0100 |
commit | 6629a1b23f31018caecf2d56d9f8bb1052e1c140 (patch) | |
tree | 73f0a01f13b6ba3290015706c5c278eed00f5eb3 /kbd.c | |
parent | c5eb4d56d6e2bb6942fea1bbbcc0cc988a903710 (diff) | |
download | fbida-6629a1b23f31018caecf2d56d9f8bb1052e1c140.tar.gz |
fbcon: sd_bus_message_read fix
Diffstat (limited to 'kbd.c')
-rw-r--r-- | kbd.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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; } |