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

Diff for /src/usr.bin/cmp/cmp.c between version 1.16 and 1.17

version 1.16, 2016/10/28 07:22:59 version 1.17, 2018/03/05 16:53:39
Line 84 
Line 84 
                 special = 1;                  special = 1;
                 fd1 = 0;                  fd1 = 0;
                 file1 = "stdin";                  file1 = "stdin";
         } else if ((fd1 = open(file1, O_RDONLY, 0)) < 0) {          } else if ((fd1 = open(file1, O_RDONLY, 0)) == -1)
                 if (sflag)                  fatal("%s", file1);
                         return ERR_EXIT;  
                 else  
                         err(ERR_EXIT, "%s", file1);  
         }  
         if (strcmp(file2 = argv[1], "-") == 0) {          if (strcmp(file2 = argv[1], "-") == 0) {
                 if (special) {                  if (special)
                         if (sflag)                          fatalx("standard input may only be specified once");
                                 return ERR_EXIT;  
                         else  
                                 errx(ERR_EXIT,  
                                         "standard input may only be specified once");  
                 }  
                 special = 1;                  special = 1;
                 fd2 = 0;                  fd2 = 0;
                 file2 = "stdin";                  file2 = "stdin";
         } else if ((fd2 = open(file2, O_RDONLY, 0)) < 0) {          } else if ((fd2 = open(file2, O_RDONLY, 0)) == -1)
                 if (sflag)                  fatal("%s", file2);
                         return ERR_EXIT;  
                 else  
                         err(ERR_EXIT, "%s", file2);  
         }  
   
         if (pledge("stdio", NULL) == -1)          if (pledge("stdio", NULL) == -1)
                 err(ERR_EXIT, "pledge");                  err(ERR_EXIT, "pledge");
Line 115 
Line 102 
         skip2 = argc == 4 ? strtoll(argv[3], NULL, 0) : 0;          skip2 = argc == 4 ? strtoll(argv[3], NULL, 0) : 0;
   
         if (!special) {          if (!special) {
                 if (fstat(fd1, &sb1)) {                  if (fstat(fd1, &sb1) == -1)
                         if (sflag)                          fatal("%s", file1);
                                 return ERR_EXIT;  
                         else  
                                 err(ERR_EXIT, "%s", file1);  
                 }  
                 if (!S_ISREG(sb1.st_mode))                  if (!S_ISREG(sb1.st_mode))
                         special = 1;                          special = 1;
                 else {                  else {
                         if (fstat(fd2, &sb2)) {                          if (fstat(fd2, &sb2) == -1)
                                 if (sflag)                                  fatal("%s", file2);
                                         return ERR_EXIT;  
                                 else  
                                         err(ERR_EXIT, "%s", file2);  
                         }  
                         if (!S_ISREG(sb2.st_mode))                          if (!S_ISREG(sb2.st_mode))
                                 special = 1;                                  special = 1;
                 }                  }

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17