X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibelogind%2Fsd-login%2Fsd-login.c;h=ac22fa3454ce57a5fc757c5726c3309752d67acd;hb=da2587d5154e11d4e643e326793f3ce2cc48dee6;hp=03d9cdbcb3ee10346a2ff121448fa31da362240a;hpb=3b22396a4b2767a98172f6915929c47738cb0a1e;p=elogind.git
diff --git a/src/libelogind/sd-login/sd-login.c b/src/libelogind/sd-login/sd-login.c
index 03d9cdbcb..ac22fa345 100644
--- a/src/libelogind/sd-login/sd-login.c
+++ b/src/libelogind/sd-login/sd-login.c
@@ -19,21 +19,33 @@
along with systemd; If not, see .
***/
-#include
-#include
#include
-#include
#include
+#include
+#include
+#include
-#include "util.h"
+#include "sd-login.h"
+
+#include "alloc-util.h"
#include "cgroup-util.h"
-#include "macro.h"
-#include "strv.h"
+#include "dirent-util.h"
+#include "escape.h"
+#include "fd-util.h"
#include "fileio.h"
-#include "login-util.h"
#include "formats-util.h"
+#include "fs-util.h"
#include "hostname-util.h"
-#include "sd-login.h"
+#include "io-util.h"
+#include "login-util.h"
+#include "macro.h"
+#include "parse-util.h"
+#include "path-util.h"
+#include "socket-util.h"
+#include "string-util.h"
+#include "strv.h"
+#include "user-util.h"
+#include "util.h"
/* Error codes:
*
@@ -58,8 +70,7 @@ _public_ int sd_pid_get_unit(pid_t pid, char **unit) {
assert_return(pid >= 0, -EINVAL);
assert_return(unit, -EINVAL);
-/// elogind does not support systemd units
-#if 0
+#if 0 /// elogind does not support systemd units
return cg_pid_get_unit(pid, unit);
#else
return -ESRCH;
@@ -71,8 +82,7 @@ _public_ int sd_pid_get_user_unit(pid_t pid, char **unit) {
assert_return(pid >= 0, -EINVAL);
assert_return(unit, -EINVAL);
-/// elogind does not support systemd units
-#if 0
+#if 0 /// elogind does not support systemd units
return cg_pid_get_user_unit(pid, unit);
#else
return -ESRCH;
@@ -84,8 +94,7 @@ _public_ int sd_pid_get_machine_name(pid_t pid, char **name) {
assert_return(pid >= 0, -EINVAL);
assert_return(name, -EINVAL);
-/// elogind does not support systemd units
-#if 0
+#if 0 /// elogind does not support systemd units
return cg_pid_get_machine_name(pid, name);
#else
return -ESRCH;
@@ -97,8 +106,7 @@ _public_ int sd_pid_get_slice(pid_t pid, char **slice) {
assert_return(pid >= 0, -EINVAL);
assert_return(slice, -EINVAL);
-/// elogind does not support systemd slices
-#if 0
+#if 0 /// elogind does not support systemd slices
return cg_pid_get_slice(pid, slice);
#else
return -ESRCH;
@@ -110,8 +118,7 @@ _public_ int sd_pid_get_user_slice(pid_t pid, char **slice) {
assert_return(pid >= 0, -EINVAL);
assert_return(slice, -EINVAL);
-/// elogind does not support systemd slices
-#if 0
+#if 0 /// elogind does not support systemd slices
return cg_pid_get_user_slice(pid, slice);
#else
return -ESRCH;
@@ -123,8 +130,7 @@ _public_ int sd_pid_get_owner_uid(pid_t pid, uid_t *uid) {
assert_return(pid >= 0, -EINVAL);
assert_return(uid, -EINVAL);
-/// elogind does not support systemd slices
-#if 0
+#if 0 /// elogind does not support systemd slices
return cg_pid_get_owner_uid(pid, uid);
#else
return -ESRCH;
@@ -168,8 +174,7 @@ _public_ int sd_peer_get_session(int fd, char **session) {
if (r < 0)
return r;
-/// elogind does not support systemd scopes
-#if 0
+#if 0 /// elogind does not support systemd scopes
return cg_pid_get_session(ucred.pid, session);
#else
return -ESRCH;
@@ -187,8 +192,7 @@ _public_ int sd_peer_get_owner_uid(int fd, uid_t *uid) {
if (r < 0)
return r;
-/// elogind does not support systemd units
-#if 0
+#if 0 /// elogind does not support systemd units
return cg_pid_get_owner_uid(ucred.pid, uid);
#else
return -ESRCH;
@@ -206,8 +210,7 @@ _public_ int sd_peer_get_unit(int fd, char **unit) {
if (r < 0)
return r;
-/// elogind does not support systemd units
-#if 0
+#if 0 /// elogind does not support systemd units
return cg_pid_get_unit(ucred.pid, unit);
#else
return -ESRCH;
@@ -225,8 +228,7 @@ _public_ int sd_peer_get_user_unit(int fd, char **unit) {
if (r < 0)
return r;
-/// elogind does not support systemd units
-#if 0
+#if 0 /// elogind does not support systemd units
return cg_pid_get_user_unit(ucred.pid, unit);
#else
return -ESRCH;
@@ -244,8 +246,7 @@ _public_ int sd_peer_get_machine_name(int fd, char **machine) {
if (r < 0)
return r;
-/// elogind does not support systemd units
-#if 0
+#if 0 /// elogind does not support systemd units
return cg_pid_get_machine_name(ucred.pid, machine);
#else
return -ESRCH;
@@ -263,8 +264,7 @@ _public_ int sd_peer_get_slice(int fd, char **slice) {
if (r < 0)
return r;
-/// elogind does not support systemd slices
-#if 0
+#if 0 /// elogind does not support systemd slices
return cg_pid_get_slice(ucred.pid, slice);
#else
return -ESRCH;
@@ -282,8 +282,7 @@ _public_ int sd_peer_get_user_slice(int fd, char **slice) {
if (r < 0)
return r;
-/// elogind does not support systemd slices
-#if 0
+#if 0 /// elogind does not support systemd slices
return cg_pid_get_user_slice(ucred.pid, slice);
#else
return -ESRCH;
@@ -381,7 +380,7 @@ static int file_of_seat(const char *seat, char **_p) {
if (!filename_is_valid(seat))
return -EINVAL;
- p = strappend("/run/systemd/seats/", seat);
+ p = strappend("/run/systemd/seats/", seat);
} else {
_cleanup_free_ char *buf = NULL;
@@ -445,10 +444,10 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) {
r = parse_env_file(p, NEWLINE, variable, &s, NULL);
if (r == -ENOENT || (r >= 0 && isempty(s))) {
- if (array)
- *array = NULL;
- return 0;
- }
+ if (array)
+ *array = NULL;
+ return 0;
+ }
if (r < 0)
return r;
@@ -985,9 +984,7 @@ _public_ int sd_machine_get_ifindices(const char *machine, int **ifindices) {
*(char*) (mempcpy(buf, word, l)) = 0;
- if (safe_atoi(buf, &ifi) < 0)
- continue;
- if (ifi <= 0)
+ if (parse_ifindex(buf, &ifi) < 0)
continue;
if (!GREEDY_REALLOC(ni, allocated, nr+1)) {