[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.108 and 1.109

version 1.108, 2015/11/24 22:27:22 version 1.109, 2015/11/24 22:45:44
Line 76 
Line 76 
 {  {
         int lockfd;          int lockfd;
   
         if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1)          if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1) {
                 fatal("open failed");                  lockfd = open("/dev/null", O_WRONLY);
                   if (lockfd == -1)
                           fatal("open failed");
                   return (lockfd);
           }
         log_debug("lock file is %s", lockfile);          log_debug("lock file is %s", lockfile);
   
         if (flock(lockfd, LOCK_EX|LOCK_NB) == -1) {          if (flock(lockfd, LOCK_EX|LOCK_NB) == -1) {
Line 114 
Line 118 
   
 retry:  retry:
         if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)          if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
                 fatal("socket failed");                  return (-1);
   
         log_debug("trying connect");          log_debug("trying connect");
         if (connect(fd, (struct sockaddr *) &sa, sizeof(sa)) == -1) {          if (connect(fd, (struct sockaddr *)&sa, sizeof sa) == -1) {
                 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;
Line 255 
Line 259 
                 cmd_list_free(cmdlist);                  cmd_list_free(cmdlist);
         }          }
   
           /* Create client process structure (starts logging). */
           client_proc = proc_start("client", base, 0, 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, cmdflags & CMD_STARTSERVER);
         if (fd == -1) {          if (fd == -1) {
Line 267 
Line 274 
                 }                  }
                 return (1);                  return (1);
         }          }
   
         /* Build process state. */  
         client_proc = proc_start("client", base, 0, client_signal);  
         client_peer = proc_add_peer(client_proc, fd, client_dispatch, NULL);          client_peer = proc_add_peer(client_proc, fd, client_dispatch, NULL);
   
         /* Save these before pledge(). */          /* Save these before pledge(). */
Line 365 
Line 369 
                         printf("%%exit\n");                          printf("%%exit\n");
                 printf("\033\\");                  printf("\033\\");
                 tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio);                  tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio);
         }          } else
                   fprintf(stderr, "%s\n", client_exit_message());
         setblocking(STDIN_FILENO, 1);          setblocking(STDIN_FILENO, 1);
         return (client_exitval);          return (client_exitval);
 }  }
Line 517 
Line 522 
         if (imsg == NULL) {          if (imsg == NULL) {
                 client_exitreason = CLIENT_EXIT_LOST_SERVER;                  client_exitreason = CLIENT_EXIT_LOST_SERVER;
                 client_exitval = 1;                  client_exitval = 1;
         } else if (client_attached)                  proc_exit(client_proc);
                   return;
           }
   
           if (client_attached)
                 client_dispatch_attached(imsg);                  client_dispatch_attached(imsg);
         else          else
                 client_dispatch_wait(imsg);                  client_dispatch_wait(imsg);

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