Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[systemd login] Handle ENODATA properly. Fixes JB#53297
Handle ENODATA similarly to ENOENT error. This is reported by systemd
when the data is not prepared yet. User change is monitored anyways, so
getting this error simply means that we do not quit the main loop just
yet and wait for the data to get ready to indicate what user is logged
in.
  • Loading branch information
LaakkonenJussi committed Aug 3, 2021
1 parent 00423b3 commit 1af3e3e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion connman/src/systemd_login.c
Expand Up @@ -447,7 +447,7 @@ static int get_session_uid_and_state(uid_t *uid,
err = sd_seat_get_active(DEFAULT_SEAT, &session, uid);
if (err < 0) {
/* No not regard -ENOENT as error, session is not ready yet */
if (err != -ENOENT)
if (err != -ENOENT && err != -ENODATA)
connman_warn("err %d failed to get active session "
"and/or user for seat %s", err,
DEFAULT_SEAT);
Expand Down Expand Up @@ -591,6 +591,10 @@ static int check_session_status(struct systemd_login_data *login_data)
/* Session is not proabably ready yet */
DBG("session not ready yet");
goto out;
case -ENODATA:
/* Session data is not ready yet */
DBG("session data is not prepared yet");
goto out;
default:
DBG("failed to get uid %u and/or state %d", uid, state);
err = -EINVAL;
Expand Down Expand Up @@ -752,6 +756,7 @@ static gboolean delayed_status_check(gpointer user_data)
case -EINPROGRESS:
break;
case -ENOENT:
case -ENODATA:
/* Session is not ready yet, keep in loop */
return G_SOURCE_CONTINUE;
default:
Expand Down

0 comments on commit 1af3e3e

Please sign in to comment.