X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind-button.c;h=210b889c4f987cd7998b38ac69e0578c77e98603;hp=9c0c6302a9cd9c8bcb5727325439f1b71680ef56;hb=77435fa5410006a32e176f128871cc402754e4e0;hpb=da927ba997d68401563b927f92e6e40e021a8e5c diff --git a/src/login/logind-button.c b/src/login/logind-button.c index 9c0c6302a..210b889c4 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -19,7 +19,6 @@ along with systemd; If not, see . ***/ -#include #include #include #include @@ -28,9 +27,7 @@ #include #include "sd-messages.h" -#include "conf-parser.h" #include "util.h" -#include "special.h" #include "logind-button.h" Button* button_new(Manager *m, const char *name) { @@ -73,7 +70,7 @@ void button_free(Button *b) { /* If the device has been unplugged close() returns * ENODEV, let's ignore this, hence we don't use * safe_close() */ - close(b->fd); + (void) close(b->fd); } free(b->name); @@ -103,7 +100,7 @@ static void button_lid_switch_handle_action(Manager *manager, bool is_edge) { assert(manager); /* If we are docked, handle the lid switch differently */ - if (manager_is_docked_or_multiple_displays(manager)) + if (manager_is_docked_or_external_displays(manager)) handle_action = manager->handle_lid_switch_docked; else handle_action = manager->handle_lid_switch; @@ -247,16 +244,14 @@ int button_open(Button *b) { b->fd = -1; } - p = strappenda("/dev/input/", b->name); + p = strjoina("/dev/input/", b->name); b->fd = open(p, O_RDWR|O_CLOEXEC|O_NOCTTY|O_NONBLOCK); - if (b->fd < 0) { - log_warning("Failed to open %s: %m", b->name); - return -errno; - } + if (b->fd < 0) + return log_warning_errno(errno, "Failed to open %s: %m", b->name); if (ioctl(b->fd, EVIOCGNAME(sizeof(name)), name) < 0) { - log_error("Failed to get input name: %m"); + log_error_errno(errno, "Failed to get input name: %m"); r = -errno; goto fail; }