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

Diff for /src/usr.bin/tmux/client.c between version 1.137 and 1.138

version 1.137, 2020/01/29 16:22:32 version 1.138, 2020/03/12 09:26:34
Line 97 
Line 97 
   
 /* Connect client to server. */  /* Connect client to server. */
 static int  static int
 client_connect(struct event_base *base, const char *path, int start_server)  client_connect(struct event_base *base, const char *path, int flags)
 {  {
         struct sockaddr_un      sa;          struct sockaddr_un      sa;
         size_t                  size;          size_t                  size;
Line 122 
Line 122 
                 log_debug("connect failed: %s", strerror(errno));                  log_debug("connect failed: %s", strerror(errno));
                 if (errno != ECONNREFUSED && errno != ENOENT)                  if (errno != ECONNREFUSED && errno != ENOENT)
                         goto failed;                          goto failed;
                 if (!start_server)                  if (~flags & CLIENT_STARTSERVER)
                         goto failed;                          goto failed;
                 close(fd);                  close(fd);
   
Line 154 
Line 154 
                         close(lockfd);                          close(lockfd);
                         return (-1);                          return (-1);
                 }                  }
                 fd = server_start(client_proc, base, lockfd, lockfile);                  fd = server_start(client_proc, flags, base, lockfd, lockfile);
         }          }
   
         if (locked && lockfd >= 0) {          if (locked && lockfd >= 0) {
Line 238 
Line 238 
         struct cmd_parse_result *pr;          struct cmd_parse_result *pr;
         struct cmd              *cmd;          struct cmd              *cmd;
         struct msg_command      *data;          struct msg_command      *data;
         int                      cmdflags, fd, i;          int                      fd, i;
         const char              *ttynam, *cwd;          const char              *ttynam, *cwd;
         pid_t                    ppid;          pid_t                    ppid;
         enum msgtype             msg;          enum msgtype             msg;
Line 248 
Line 248 
         /* Ignore SIGCHLD now or daemon() in the server will leave a zombie. */          /* Ignore SIGCHLD now or daemon() in the server will leave a zombie. */
         signal(SIGCHLD, SIG_IGN);          signal(SIGCHLD, SIG_IGN);
   
         /* Save the flags. */  
         client_flags = flags;  
   
         /* Set up the initial command. */          /* Set up the initial command. */
         cmdflags = 0;  
         if (shell_command != NULL) {          if (shell_command != NULL) {
                 msg = MSG_SHELL;                  msg = MSG_SHELL;
                 cmdflags = CMD_STARTSERVER;                  flags = CLIENT_STARTSERVER;
         } else if (argc == 0) {          } else if (argc == 0) {
                 msg = MSG_COMMAND;                  msg = MSG_COMMAND;
                 cmdflags = CMD_STARTSERVER;                  flags |= CLIENT_STARTSERVER;
         } else {          } else {
                 msg = MSG_COMMAND;                  msg = MSG_COMMAND;
   
Line 271 
Line 267 
                 if (pr->status == CMD_PARSE_SUCCESS) {                  if (pr->status == CMD_PARSE_SUCCESS) {
                         TAILQ_FOREACH(cmd, &pr->cmdlist->list, qentry) {                          TAILQ_FOREACH(cmd, &pr->cmdlist->list, qentry) {
                                 if (cmd->entry->flags & CMD_STARTSERVER)                                  if (cmd->entry->flags & CMD_STARTSERVER)
                                         cmdflags |= CMD_STARTSERVER;                                          flags |= CLIENT_STARTSERVER;
                         }                          }
                         cmd_list_free(pr->cmdlist);                          cmd_list_free(pr->cmdlist);
                 } else                  } else
                         free(pr->error);                          free(pr->error);
         }          }
   
           /* Save the flags. */
           client_flags = flags;
   
         /* Create client process structure (starts logging). */          /* Create client process structure (starts logging). */
         client_proc = proc_start("client");          client_proc = proc_start("client");
         proc_set_signals(client_proc, client_signal);          proc_set_signals(client_proc, client_signal);
   
         /* Initialize the client socket and start the server. */          /* Initialize the client socket and start the server. */
         fd = client_connect(base, socket_path, cmdflags & CMD_STARTSERVER);          fd = client_connect(base, socket_path, client_flags);
         if (fd == -1) {          if (fd == -1) {
                 if (errno == ECONNREFUSED) {                  if (errno == ECONNREFUSED) {
                         fprintf(stderr, "no server running on %s\n",                          fprintf(stderr, "no server running on %s\n",

Legend:
Removed from v.1.137  
changed lines
  Added in v.1.138