if (r < 0)
return r;
- r = dup(fd);
+ r = fcntl(fd, F_DUPFD_CLOEXEC, 3);
if (r < 0)
return -errno;
r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssssuu)");
if (r < 0)
- return -EIO;
+ return bus_log_parse_error(r);
while ((r = sd_bus_message_read(reply, "(ssssuu)", &what, &who, &why, &mode, &uid, &pid)) > 0) {
_cleanup_free_ char *comm = NULL, *u = NULL;
get_process_comm(pid, &comm);
u = uid_to_name(uid);
- printf(" Who: %s (UID %lu/%s, PID %lu/%s)\n"
+ printf(" Who: %s (UID "UID_FMT"/%s, PID "PID_FMT"/%s)\n"
" What: %s\n"
" Why: %s\n"
" Mode: %s\n\n",
- who, (unsigned long) uid, strna(u), (unsigned long) pid, strna(comm),
+ who, uid, strna(u), pid, strna(comm),
what,
why,
mode);
n++;
}
if (r < 0)
- return -EIO;
+ return bus_log_parse_error(r);
r = sd_bus_message_exit_container(reply);
if (r < 0)
- return -EIO;
+ return bus_log_parse_error(r);
printf("%u inhibitors listed.\n", n);
return 0;
if (r == 0)
return EXIT_SUCCESS;
- r = sd_bus_open_system(&bus);
+ r = sd_bus_default_system(&bus);
if (r < 0) {
log_error("Failed to connect to bus: %s", strerror(-r));
return EXIT_FAILURE;