-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
errno = 0;
p = getpwuid(uid);
if (!p)
- return errno ? -errno : -ENOENT;
+ return errno > 0 ? -errno : -ENOENT;
return manager_add_user(m, uid, p->pw_gid, p->pw_name, _user);
}
}
int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session) {
-/// elogind does not support systemd units, but its own session system
-#if 0
+#if 0 /// elogind does not support systemd units, but its own session system
_cleanup_free_ char *unit = NULL;
#else
_cleanup_free_ char *session_name = NULL;
if (pid < 1)
return -EINVAL;
-/// elogind does not support systemd units, but its own session system
-#if 0
+#if 0 /// elogind does not support systemd units, but its own session system
r = cg_pid_get_unit(pid, &unit);
if (r < 0)
return 0;
}
int manager_get_user_by_pid(Manager *m, pid_t pid, User **user) {
-/// elogind does not support systemd units, but its own session system
-#if 0
+#if 0 /// elogind does not support systemd units, but its own session system
_cleanup_free_ char *unit = NULL;
User *u;
#else
if (pid < 1)
return -EINVAL;
-/// elogind does not support systemd units, but its own session system
-#if 0
+#if 0 /// elogind does not support systemd units, but its own session system
r = cg_pid_get_slice(pid, &unit);
if (r < 0)
return 0;
*user = s->user;
#endif // 0
-
return 1;
}
assert(m);
assert(user);
- if (!m->kill_user_processes)
+ if (!m->kill_exclude_users && streq(user, "root"))
return false;
if (strv_contains(m->kill_exclude_users, user))
return false;
- if (strv_isempty(m->kill_only_users))
- return true;
+ if (!strv_isempty(m->kill_only_users))
+ return strv_contains(m->kill_only_users, user);
- return strv_contains(m->kill_only_users, user);
+ return m->kill_user_processes;
}
#if 0 /// UNNEEDED by elogind
}
int manager_spawn_autovt(Manager *m, unsigned int vtnr) {
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
char name[sizeof("autovt@tty.service") + DECIMAL_STR_MAX(unsigned int)];
int r;
continue;
/* Ignore internal displays: the type is encoded in
- * the sysfs name, as the second dash seperated item
+ * the sysfs name, as the second dash separated item
* (the first is the card name, the last the connector
* number). We implement a whitelist of external
* displays here, rather than a whitelist, to ensure