=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/inp.c,v retrieving revision 1.48 retrieving revision 1.49 diff -c -r1.48 -r1.49 *** src/usr.bin/patch/inp.c 2018/04/26 12:42:51 1.48 --- src/usr.bin/patch/inp.c 2019/06/28 13:35:02 1.49 *************** *** 1,4 **** ! /* $OpenBSD: inp.c,v 1.48 2018/04/26 12:42:51 guenther Exp $ */ /* * patch - a program to apply diffs to original files --- 1,4 ---- ! /* $OpenBSD: inp.c,v 1.49 2019/06/28 13:35:02 deraadt Exp $ */ /* * patch - a program to apply diffs to original files *************** *** 179,185 **** say("block too large to mmap\n"); return false; } ! if ((ifd = open(filename, O_RDONLY)) < 0) pfatal("can't open file %s", filename); if (i_size) { --- 179,185 ---- say("block too large to mmap\n"); return false; } ! if ((ifd = open(filename, O_RDONLY)) == -1) pfatal("can't open file %s", filename); if (i_size) { *************** *** 285,291 **** if ((ifp = fopen(filename, "r")) == NULL) pfatal("can't open file %s", filename); (void) unlink(TMPINNAME); ! if ((tifd = open(TMPINNAME, O_EXCL | O_CREAT | O_WRONLY, 0666)) < 0) pfatal("can't open file %s", TMPINNAME); while ((p = fgetln(ifp, &len)) != NULL) { if (p[len - 1] == '\n') --- 285,291 ---- if ((ifp = fopen(filename, "r")) == NULL) pfatal("can't open file %s", filename); (void) unlink(TMPINNAME); ! if ((tifd = open(TMPINNAME, O_EXCL | O_CREAT | O_WRONLY, 0666)) == -1) pfatal("can't open file %s", TMPINNAME); while ((p = fgetln(ifp, &len)) != NULL) { if (p[len - 1] == '\n') *************** *** 363,369 **** } fclose(ifp); close(tifd); ! if ((tifd = open(TMPINNAME, O_RDONLY)) < 0) pfatal("can't reopen file %s", TMPINNAME); } --- 363,369 ---- } fclose(ifp); close(tifd); ! if ((tifd = open(TMPINNAME, O_RDONLY)) == -1) pfatal("can't reopen file %s", TMPINNAME); } *************** *** 394,400 **** tiline[whichbuf] = baseline; if (lseek(tifd, (off_t) (baseline / lines_per_buf * ! tibuflen), SEEK_SET) < 0) pfatal("cannot seek in the temporary input file"); if (read(tifd, tibuf[whichbuf], tibuflen) --- 394,400 ---- tiline[whichbuf] = baseline; if (lseek(tifd, (off_t) (baseline / lines_per_buf * ! tibuflen), SEEK_SET) == -1) pfatal("cannot seek in the temporary input file"); if (read(tifd, tibuf[whichbuf], tibuflen)