[BACK]Return to cmd-queue.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-queue.c between version 1.107 and 1.108

version 1.107, 2021/08/21 17:25:32 version 1.108, 2022/05/30 12:48:57
Line 19 
Line 19 
 #include <sys/types.h>  #include <sys/types.h>
   
 #include <ctype.h>  #include <ctype.h>
   #include <pwd.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <time.h>  #include <time.h>
   #include <unistd.h>
   
 #include "tmux.h"  #include "tmux.h"
   
Line 558 
Line 560 
 {  {
         struct client           *c = item->client;          struct client           *c = item->client;
         struct cmdq_state       *state = item->state;          struct cmdq_state       *state = item->state;
         const char              *name, *key;          const char              *key;
         char                    *tmp;          char                    *tmp;
           uid_t                    uid;
           struct passwd           *pw;
           char                    *user = NULL;
   
         tmp = cmd_print(item->cmd);          tmp = cmd_print(item->cmd);
         if (c != NULL) {          if (c != NULL) {
                 name = c->name;                  uid = proc_get_peer_uid(c->peer);
                   if (uid != (uid_t)-1 && uid != getuid()) {
                           if ((pw = getpwuid(uid)) != NULL)
                                   xasprintf(&user, "[%s]", pw->pw_name);
                           else
                                   user = xstrdup("[unknown]");
                   } else
                           user = xstrdup("");
                 if (c->session != NULL && state->event.key != KEYC_NONE) {                  if (c->session != NULL && state->event.key != KEYC_NONE) {
                         key = key_string_lookup_key(state->event.key, 0);                          key = key_string_lookup_key(state->event.key, 0);
                         server_add_message("%s key %s: %s", name, key, tmp);                          server_add_message("%s%s key %s: %s", c->name, user,
                 } else                              key, tmp);
                         server_add_message("%s command: %s", name, tmp);                  } else {
                           server_add_message("%s%s command: %s", c->name, user,
                               tmp);
                   }
                   free(user);
         } else          } else
                 server_add_message("command: %s", tmp);                  server_add_message("command: %s", tmp);
         free(tmp);          free(tmp);

Legend:
Removed from v.1.107  
changed lines
  Added in v.1.108