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

Diff for /src/usr.bin/tmux/cmd-load-buffer.c between version 1.24 and 1.25

version 1.24, 2013/10/10 12:00:21 version 1.25, 2013/10/10 12:26:35
Line 19 
Line 19 
 #include <sys/types.h>  #include <sys/types.h>
   
 #include <errno.h>  #include <errno.h>
   #include <fcntl.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 49 
Line 50 
         struct client   *c = cmdq->client;          struct client   *c = cmdq->client;
         struct session  *s;          struct session  *s;
         FILE            *f;          FILE            *f;
         const char      *path, *newpath, *wd;          const char      *path;
         char            *pdata, *new_pdata, *cause;          char            *pdata, *new_pdata, *cause;
         size_t           psize;          size_t           psize;
         u_int            limit;          u_int            limit;
         int              ch, error, buffer, *buffer_ptr;          int              ch, error, buffer, *buffer_ptr, cwd, fd;
   
         if (!args_has(args, 'b'))          if (!args_has(args, 'b'))
                 buffer = -1;                  buffer = -1;
Line 81 
Line 82 
                 return (CMD_RETURN_WAIT);                  return (CMD_RETURN_WAIT);
         }          }
   
         if (c != NULL)          if (c != NULL && c->session == NULL)
                 wd = c->cwd;                  cwd = c->cwd;
         else if ((s = cmd_current_session(cmdq, 0)) != NULL) {          else if ((s = cmd_current_session(cmdq, 0)) != NULL)
                 wd = options_get_string(&s->options, "default-path");                  cwd = s->cwd;
                 if (*wd == '\0')          else
                         wd = s->cwd;                  cwd = AT_FDCWD;
         } else  
                 wd = NULL;          if ((fd = openat(cwd, path, O_RDONLY)) == -1 ||
         if (wd != NULL && *wd != '\0') {              (f = fdopen(fd, "rb")) == NULL) {
                 newpath = get_full_path(wd, path);                  if (fd != -1)
                 if (newpath != NULL)                          close(fd);
                         path = newpath;  
         }  
         if ((f = fopen(path, "rb")) == NULL) {  
                 cmdq_error(cmdq, "%s: %s", path, strerror(errno));                  cmdq_error(cmdq, "%s: %s", path, strerror(errno));
                 return (CMD_RETURN_ERROR);                  return (CMD_RETURN_ERROR);
         }          }

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25