chiark / gitweb /
sd-login: rework error handling
authorLennart Poettering <lennart@poettering.net>
Fri, 4 Sep 2015 07:05:52 +0000 (09:05 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 29 Mar 2017 08:45:08 +0000 (10:45 +0200)
Makre sure we always return sensible errors for the various, following
the same rules, and document them in a comment in sd-login.c. Also,
update all relevant man pages accordingly.

src/libelogind/sd-login/test-login.c

index 6531b9db384514f844332ba39eb2e533076d68fa..b27c581f75d3f425a7c61cf9d71f9ccba7681060 100644 (file)
@@ -52,7 +52,7 @@ static void test_login(void) {
 
         display_session = NULL;
         r = sd_uid_get_display(u2, &display_session);
-        assert_se(r >= 0 || r == -ENXIO);
+        assert_se(r >= 0 || r == -ENODATA);
         printf("user's display session = %s\n", strna(display_session));
         free(display_session);
 
@@ -108,19 +108,19 @@ static void test_login(void) {
 
         display = NULL;
         r = sd_session_get_display(session, &display);
-        assert_se(r >= 0 || r == -ENXIO);
+        assert_se(r >= 0 || r == -ENODATA);
         printf("display = %s\n", strna(display));
         free(display);
 
         remote_user = NULL;
         r = sd_session_get_remote_user(session, &remote_user);
-        assert_se(r >= 0 || r == -ENXIO);
+        assert_se(r >= 0 || r == -ENODATA);
         printf("remote_user = %s\n", strna(remote_user));
         free(remote_user);
 
         remote_host = NULL;
         r = sd_session_get_remote_host(session, &remote_host);
-        assert_se(r >= 0 || r == -ENXIO);
+        assert_se(r >= 0 || r == -ENODATA);
         printf("remote_host = %s\n", strna(remote_host));
         free(remote_host);