chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
logind: relax udev rules matching devices logind watches for
[elogind.git]
/
src
/
login
/
logind-inhibit.c
diff --git
a/src/login/logind-inhibit.c
b/src/login/logind-inhibit.c
index 0c9c1e5e9795065e1ce4bd552cae76e281579b91..1e6f3837382fe163fed58bbeda901abdda364d91 100644
(file)
--- a/
src/login/logind-inhibit.c
+++ b/
src/login/logind-inhibit.c
@@
-1,5
+1,3
@@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
/***
This file is part of systemd.
@@
-24,11
+22,18
@@
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>
-#include "util.h"
-#include "
mkdir
.h"
-#include "
logind-inhibit
.h"
+#include "
alloc-
util.h"
+#include "
escape
.h"
+#include "
fd-util
.h"
#include "fileio.h"
#include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
+#include "logind-inhibit.h"
+#include "mkdir.h"
+#include "parse-util.h"
+#include "string-table.h"
+#include "string-util.h"
+#include "user-util.h"
+#include "util.h"
Inhibitor* inhibitor_new(Manager *m, const char* id) {
Inhibitor *i;
Inhibitor* inhibitor_new(Manager *m, const char* id) {
Inhibitor *i;
@@
-40,17
+45,14
@@
Inhibitor* inhibitor_new(Manager *m, const char* id) {
return NULL;
i->state_file = strappend("/run/systemd/inhibit/", id);
return NULL;
i->state_file = strappend("/run/systemd/inhibit/", id);
- if (!i->state_file) {
- free(i);
- return NULL;
- }
+ if (!i->state_file)
+ return mfree(i);
i->id = basename(i->state_file);
if (hashmap_put(m->inhibitors, i->id, i) < 0) {
free(i->state_file);
i->id = basename(i->state_file);
if (hashmap_put(m->inhibitors, i->id, i) < 0) {
free(i->state_file);
- free(i);
- return NULL;
+ return mfree(i);
}
i->manager = m;
}
i->manager = m;
@@
-292,7
+294,7
@@
int inhibitor_create_fifo(Inhibitor *i) {
if (r < 0)
return r;
if (r < 0)
return r;
- i->fifo_path = strjoin("/run/systemd/inhibit/", i->id, ".ref"
, NULL
);
+ i->fifo_path = strjoin("/run/systemd/inhibit/", i->id, ".ref");
if (!i->fifo_path)
return -ENOMEM;
if (!i->fifo_path)
return -ENOMEM;
@@
-312,7
+314,7
@@
int inhibitor_create_fifo(Inhibitor *i) {
if (r < 0)
return r;
if (r < 0)
return r;
- r = sd_event_source_set_priority(i->event_source, SD_EVENT_PRIORITY_IDLE);
+ r = sd_event_source_set_priority(i->event_source, SD_EVENT_PRIORITY_IDLE
-10
);
if (r < 0)
return r;
}
if (r < 0)
return r;
}
@@
-345,7
+347,7
@@
InhibitWhat manager_inhibit_what(Manager *m, InhibitMode mm) {
assert(m);
HASHMAP_FOREACH(i, m->inhibitors, j)
assert(m);
HASHMAP_FOREACH(i, m->inhibitors, j)
- if (i->mode == mm)
+ if (i->mode == mm
&& i->started
)
what |= i->what;
return what;
what |= i->what;
return what;
@@
-386,6
+388,9
@@
bool manager_is_inhibited(
assert(w > 0 && w < _INHIBIT_WHAT_MAX);
HASHMAP_FOREACH(i, m->inhibitors, j) {
assert(w > 0 && w < _INHIBIT_WHAT_MAX);
HASHMAP_FOREACH(i, m->inhibitors, j) {
+ if (!i->started)
+ continue;
+
if (!(i->what & w))
continue;
if (!(i->what & w))
continue;