diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-01 00:40:20 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-01 17:20:56 +0200 |
commit | fc60d8153caebaeea8461e5c3ea1efe404d989d5 (patch) | |
tree | 5a5f317e0e24657bf589536ae23e875f2863781a /src/libsystemd/sd-login/sd-login.c | |
parent | 9660efb82fa8043f47023617a205e3796414ce5c (diff) |
sd-login: improve error handling
let's return ENXIO whenever we don't know something rather than ENOENT.
ENOENT suggests this was really about a file or directory, while ENXIO
is a more generic "not found" indicator.
Diffstat (limited to 'src/libsystemd/sd-login/sd-login.c')
-rw-r--r-- | src/libsystemd/sd-login/sd-login.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 0eadc8c747..7d6a4b78cf 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -237,11 +237,13 @@ _public_ int sd_uid_get_display(uid_t uid, char **session) { return r; r = parse_env_file(p, NEWLINE, "DISPLAY", &s, NULL); + if (r == -ENOENT) + return -ENXIO; if (r < 0) return r; if (isempty(s)) - return -ENOENT; + return -ENXIO; *session = s; s = NULL; @@ -465,7 +467,7 @@ static int session_get_string(const char *session, const char *field, char **val return r; if (isempty(s)) - return -ENOENT; + return -ENXIO; *value = s; s = NULL; |