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

Diff for /src/usr.bin/rcs/ci.c between version 1.162 and 1.163

version 1.162, 2006/04/26 02:55:13 version 1.163, 2006/04/26 21:55:22
Line 100 
Line 100 
 int  int
 checkin_main(int argc, char **argv)  checkin_main(int argc, char **argv)
 {  {
           int fd;
         int i, ch, status;          int i, ch, status;
         char *rev_str;          char *rev_str;
         struct checkin_params pb;          struct checkin_params pb;
Line 229 
Line 230 
         if ((pb.username = getlogin()) == NULL)          if ((pb.username = getlogin()) == NULL)
                 err(1, "getlogin");                  err(1, "getlogin");
   
   
         for (i = 0; i < argc; i++) {          for (i = 0; i < argc; i++) {
                 pb.filename = argv[i];                  pb.filename = argv[i];
   
Line 240 
Line 240 
                  * Test for existence of ,v file. If we are expected to                   * Test for existence of ,v file. If we are expected to
                  * create one, set NEWFILE flag.                   * create one, set NEWFILE flag.
                  */                   */
                 if (rcs_statfile(pb.filename, pb.fpath,                  fd = rcs_statfile(pb.filename, pb.fpath, sizeof(pb.fpath),
                     sizeof(pb.fpath), pb.flags) < 0) {                      pb.flags);
   
                   if (fd < 0) {
                         if (pb.openflags & RCS_CREATE)                          if (pb.openflags & RCS_CREATE)
                                 pb.flags |= NEWFILE;                                  pb.flags |= NEWFILE;
                         else {                          else {
Line 254 
Line 256 
                         if (pb.flags & CI_INIT) {                          if (pb.flags & CI_INIT) {
                                 warnx("%s already exists", pb.fpath);                                  warnx("%s already exists", pb.fpath);
                                 status = 1;                                  status = 1;
                                   (void)close(fd);
                                 (void)close(workfile_fd);                                  (void)close(workfile_fd);
                                 continue;                                  continue;
                         }                          }
Line 264 
Line 267 
                  * If we are to create a new ,v file, we must decide where it                   * If we are to create a new ,v file, we must decide where it
                  * should go.                   * should go.
                  */                   */
                 if (pb.flags & NEWFILE) {                  if (pb.flags & NEWFILE)
                         char *fpath = rcs_choosefile(pb.filename);                          fd = rcs_choosefile(pb.filename,
                         if (fpath == NULL) {                              pb.fpath, sizeof(pb.fpath));
                                 status = 1;  
                                 (void)close(workfile_fd);  
                                 continue;  
                         }  
                         strlcpy(pb.fpath, fpath, sizeof(pb.fpath));  
                         xfree(fpath);  
                 }  
   
                 pb.file = rcs_open(pb.fpath, pb.openflags, pb.fmode);                  pb.file = rcs_open(pb.fpath, fd, pb.openflags, pb.fmode);
                 if (pb.file == NULL)                  if (pb.file == NULL)
                         errx(1, "failed to open rcsfile `%s'", pb.fpath);                          errx(1, "failed to open rcsfile `%s'", pb.fpath);
   

Legend:
Removed from v.1.162  
changed lines
  Added in v.1.163