chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tree-wide: sort includes in *.h
[elogind.git]
/
src
/
login
/
test-inhibit.c
diff --git
a/src/login/test-inhibit.c
b/src/login/test-inhibit.c
index 21d233961615a319e3be5a00d5a0fa1d80f8fb1e..d0727ff7c7e760b98eb381b947f30989c203f34f 100644
(file)
--- a/
src/login/test-inhibit.c
+++ b/
src/login/test-inhibit.c
@@
-21,11
+21,12
@@
#include <unistd.h>
#include <unistd.h>
-#include "macro.h"
-#include "util.h"
#include "sd-bus.h"
#include "sd-bus.h"
+
#include "bus-util.h"
#include "bus-util.h"
-#include "bus-error.h"
+#include "fd-util.h"
+#include "macro.h"
+#include "util.h"
static int inhibit(sd_bus *bus, const char *what) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
static int inhibit(sd_bus *bus, const char *what) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
@@
-42,11
+43,11
@@
static int inhibit(sd_bus *bus, const char *what) {
&error,
&reply,
"ssss", what, who, reason, mode);
&error,
&reply,
"ssss", what, who, reason, mode);
- assert(r >= 0);
+ assert
_se
(r >= 0);
r = sd_bus_message_read_basic(reply, SD_BUS_TYPE_UNIX_FD, &fd);
r = sd_bus_message_read_basic(reply, SD_BUS_TYPE_UNIX_FD, &fd);
- assert(r >= 0);
- assert(fd >= 0);
+ assert
_se
(r >= 0);
+ assert
_se
(fd >= 0);
return dup(fd);
}
return dup(fd);
}
@@
-67,18
+68,18
@@
static void print_inhibitors(sd_bus *bus) {
&error,
&reply,
"");
&error,
&reply,
"");
- assert(r >= 0);
+ assert
_se
(r >= 0);
r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssssuu)");
r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssssuu)");
- assert(r >= 0);
+ assert
_se
(r >= 0);
while ((r = sd_bus_message_read(reply, "(ssssuu)", &what, &who, &why, &mode, &uid, &pid)) > 0) {
while ((r = sd_bus_message_read(reply, "(ssssuu)", &what, &who, &why, &mode, &uid, &pid)) > 0) {
- printf("what=<%s> who=<%s> why=<%s> mode=<%s> uid=<
"UID_FMT"> pid=<"PID_FMT
">\n",
+ printf("what=<%s> who=<%s> why=<%s> mode=<%s> uid=<
%"PRIu32"> pid=<%"PRIu32
">\n",
what, who, why, mode, uid, pid);
n++;
}
what, who, why, mode, uid, pid);
n++;
}
- assert(r >= 0);
+ assert
_se
(r >= 0);
printf("%u inhibitors\n", n);
}
printf("%u inhibitors\n", n);
}
@@
-89,16
+90,16
@@
int main(int argc, char*argv[]) {
int r;
r = sd_bus_open_system(&bus);
int r;
r = sd_bus_open_system(&bus);
- assert(r >= 0);
+ assert
_se
(r >= 0);
print_inhibitors(bus);
fd1 = inhibit(bus, "sleep");
print_inhibitors(bus);
fd1 = inhibit(bus, "sleep");
- assert(fd1 >= 0);
+ assert
_se
(fd1 >= 0);
print_inhibitors(bus);
fd2 = inhibit(bus, "idle:shutdown");
print_inhibitors(bus);
fd2 = inhibit(bus, "idle:shutdown");
- assert(fd2 >= 0);
+ assert
_se
(fd2 >= 0);
print_inhibitors(bus);
safe_close(fd1);
print_inhibitors(bus);
safe_close(fd1);