chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus: log message parsing errors everywhere with a generalized bus_log_parse_error()
[elogind.git]
/
src
/
login
/
sd-login.c
diff --git
a/src/login/sd-login.c
b/src/login/sd-login.c
index 8a7838d566ed84cc556607cba3fcf0939356f34e..7e25041f6d833aac95379dbba0ec88ef2a00e88a 100644
(file)
--- a/
src/login/sd-login.c
+++ b/
src/login/sd-login.c
@@
-31,6
+31,7
@@
#include "sd-login.h"
#include "strv.h"
#include "fileio.h"
#include "sd-login.h"
#include "strv.h"
#include "fileio.h"
+#include "login-shared.h"
_public_ int sd_pid_get_session(pid_t pid, char **session) {
if (pid < 0)
_public_ int sd_pid_get_session(pid_t pid, char **session) {
if (pid < 0)
@@
-226,17
+227,19
@@
static int file_of_session(const char *session, char **_p) {
assert(_p);
assert(_p);
- if (session)
+ if (session) {
+ if (!session_id_valid(session))
+ return -EINVAL;
+
p = strappend("/run/systemd/sessions/", session);
p = strappend("/run/systemd/sessions/", session);
- else {
-
char *buf
;
+
}
else {
+
_cleanup_free_ char *buf = NULL
;
r = sd_pid_get_session(0, &buf);
if (r < 0)
return r;
p = strappend("/run/systemd/sessions/", buf);
r = sd_pid_get_session(0, &buf);
if (r < 0)
return r;
p = strappend("/run/systemd/sessions/", buf);
- free(buf);
}
if (!p)
}
if (!p)
@@
-255,7
+258,6
@@
_public_ int sd_session_is_active(const char *session) {
return r;
r = parse_env_file(p, NEWLINE, "ACTIVE", &s, NULL);
return r;
r = parse_env_file(p, NEWLINE, "ACTIVE", &s, NULL);
-
if (r < 0)
return r;
if (r < 0)
return r;
@@
-348,11
+350,11
@@
_public_ int sd_session_get_tty(const char *session, char **tty) {
}
_public_ int sd_session_get_vt(const char *session, unsigned *vtnr) {
}
_public_ int sd_session_get_vt(const char *session, unsigned *vtnr) {
- _cleanup_free_ char *vtnr_string;
+ _cleanup_free_ char *vtnr_string
= NULL
;
unsigned u;
int r;
unsigned u;
int r;
- r = session_get_string(session, "VTN
r
", &vtnr_string);
+ r = session_get_string(session, "VTN
R
", &vtnr_string);
if (r < 0)
return r;
if (r < 0)
return r;