Skip to content

Commit

Permalink
#239: Fix LC_ALL usage (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdope committed Jul 22, 2024
1 parent e9a1020 commit d092eaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ char *pusb_get_tty_by_xorg_display(const char *display, const char *user)

char *pusb_get_tty_by_loginctl()
{
char loginctl_cmd[BUFSIZ] = "LC_ALL=c; LOGINCTL_SESSION_ID=`loginctl user-status | grep -m 1 \"├─session-\" | grep -o '[0-9]\\+'`; loginctl show-session $LOGINCTL_SESSION_ID -p TTY | awk -F= '{print $2}'";
char loginctl_cmd[BUFSIZ] = "LC_ALL=C; LOGINCTL_SESSION_ID=`loginctl user-status | grep -m 1 \"├─session-\" | grep -o '[0-9]\\+'`; loginctl show-session $LOGINCTL_SESSION_ID -p TTY | awk -F= '{print $2}'";
char buf[BUFSIZ];
FILE *fp;

Expand Down Expand Up @@ -233,7 +233,7 @@ char *pusb_get_tty_by_loginctl()

int pusb_is_loginctl_local()
{
char loginctl_cmd[BUFSIZ] = "LC_ALL=c; 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 loginctl_cmd[BUFSIZ] = "LC_ALL=C; 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];
FILE *fp;

Expand Down
4 changes: 2 additions & 2 deletions src/tmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ char *pusb_tmux_get_client_tty(pid_t env_pid)
log_debug(" Got tmux_socket_path: %s\n", tmux_socket_path);

char get_tmux_session_details_cmd[128];
sprintf(get_tmux_session_details_cmd, "LC_ALL=c; tmux -S \"%s\" list-clients -t \"\\$%s\"", tmux_socket_path, tmux_client_id);
sprintf(get_tmux_session_details_cmd, "LC_ALL=C; tmux -S \"%s\" list-clients -t \"\\$%s\"", tmux_socket_path, tmux_client_id);
log_debug(" Built get_tmux_session_details_cmd: %s\n", get_tmux_session_details_cmd);

char buf[BUFSIZ];
Expand Down Expand Up @@ -106,7 +106,7 @@ int pusb_tmux_has_remote_clients(const char* username)
{
log_debug(" Checking for IPv%d connections...\n", (4 + (i * 2)));

if ((fp = popen("LC_ALL=c; w", "r")) == NULL)
if ((fp = popen("LC_ALL=C; w", "r")) == NULL)
{
log_error("tmux detected, but couldn't get `w`. Denying since remote check for tmux impossible without it!\n");
return -1;
Expand Down

0 comments on commit d092eaa

Please sign in to comment.