X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-inhibit.c;h=9994084f93dc3d41427a6de22e0153a629213256;hb=737563e4bb1606cae1dd0e9484f9e82da466fe76;hp=f1b9cca834c95eb1b40c68646e5fc45b990d8a5c;hpb=8e7fd6ade44ce5dde0867ba748c7978ed1206865;p=elogind.git diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index f1b9cca83..9994084f9 100644 --- a/src/login/logind-inhibit.c +++ b/src/login/logind-inhibit.c @@ -30,6 +30,7 @@ #include "mkdir.h" #include "path-util.h" #include "logind-inhibit.h" +#include "fileio.h" Inhibitor* inhibitor_new(Manager *m, const char* id) { Inhibitor *i; @@ -439,19 +440,19 @@ InhibitWhat inhibit_what_from_string(const char *s) { size_t l; FOREACH_WORD_SEPARATOR(w, l, s, ":", state) { - if (l == 8 && strncmp(w, "shutdown", l) == 0) + if (l == 8 && strneq(w, "shutdown", l)) what |= INHIBIT_SHUTDOWN; - else if (l == 5 && strncmp(w, "sleep", l) == 0) + else if (l == 5 && strneq(w, "sleep", l)) what |= INHIBIT_SLEEP; - else if (l == 4 && strncmp(w, "idle", l) == 0) + else if (l == 4 && strneq(w, "idle", l)) what |= INHIBIT_IDLE; - else if (l == 16 && strncmp(w, "handle-power-key", l) == 0) + else if (l == 16 && strneq(w, "handle-power-key", l)) what |= INHIBIT_HANDLE_POWER_KEY; - else if (l == 18 && strncmp(w, "handle-suspend-key", l) == 0) + else if (l == 18 && strneq(w, "handle-suspend-key", l)) what |= INHIBIT_HANDLE_SUSPEND_KEY; - else if (l == 20 && strncmp(w, "handle-hibernate-key", l) == 0) + else if (l == 20 && strneq(w, "handle-hibernate-key", l)) what |= INHIBIT_HANDLE_HIBERNATE_KEY; - else if (l == 17 && strncmp(w, "handle-lid-switch", l) == 0) + else if (l == 17 && strneq(w, "handle-lid-switch", l)) what |= INHIBIT_HANDLE_LID_SWITCH; else return _INHIBIT_WHAT_INVALID;