Skip to content

Commit

Permalink
Make pusb_is_loginctl_local() return int (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdope authored Jan 2, 2024
1 parent 293fc67 commit c5c336f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ char *pusb_get_tty_by_loginctl()
}
}

char *pusb_is_loginctl_local()
int pusb_is_loginctl_local()
{
char loginctl_cmd[BUFSIZ] = "LOGINCTL_SESSION_ID=`loginctl user-status | grep -m 1 \"├─session-\" | grep -o '[0-9]\\+'`; loginctl show-session $LOGINCTL_SESSION_ID -p Remote | awk -F= '{print $2}'";
char buf[BUFSIZ];
Expand Down Expand Up @@ -365,8 +365,7 @@ int pusb_local_login(t_pusb_options *opts, const char *user, const char *service
{
log_debug(" Trying to check for remote access by loginctl\n");

char *loginctl_remote = (char *)xmalloc(2);
loginctl_remote = pusb_is_loginctl_local();
int loginctl_remote = pusb_is_loginctl_local();
if (loginctl_remote != 0)
{
log_debug(" loginctl says this session is local\n");
Expand All @@ -387,6 +386,8 @@ int pusb_local_login(t_pusb_options *opts, const char *user, const char *service
{
log_debug(" Failed, could not obtain tty from loginctl - see line before this for reason.\n", loginctl_tty);
}

xfree(loginctl_tty);
}
}
}
Expand Down

0 comments on commit c5c336f

Please sign in to comment.