aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/patch
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2013-05-24 18:54:52 +0000
committerStefan Eßer <se@FreeBSD.org>2013-05-24 18:54:52 +0000
commit2360cb0eeab2eae6afc8db630b7b167d19b33d6e (patch)
treebf61893d33a6e4fabf5a172871b5c1bffcb6b016 /usr.bin/patch
parent936d0074cc8d7451c0701ab0d72010d5552c3582 (diff)
downloadsrc-2360cb0eeab2eae6afc8db630b7b167d19b33d6e.tar.gz
src-2360cb0eeab2eae6afc8db630b7b167d19b33d6e.zip
The error handling for writes to the target file could lead to the final
fclose() being skipped. Fix this by using boolean "&" and "|" instead of short-cut operators "&&" and "||". While here, increment the last part of the version string. The reason is the fixed output file selection logic in pch.c, which was committed as r250943, yesterday. Reviewed by: pfg
Notes
Notes: svn path=/head/; revision=250972
Diffstat (limited to 'usr.bin/patch')
-rw-r--r--usr.bin/patch/patch.c6
-rw-r--r--usr.bin/patch/util.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index d008c0f5aecb..c898ee4a408c 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -303,7 +303,7 @@ main(int argc, char *argv[])
++fuzz <= mymaxfuzz);
if (skip_rest_of_patch) { /* just got decided */
- if (ferror(ofp) || fclose(ofp)) {
+ if (ferror(ofp) | fclose(ofp)) {
say("Error writing %s\n",
TMPOUTNAME);
error = 1;
@@ -385,7 +385,7 @@ main(int argc, char *argv[])
}
}
}
- if (ferror(rejfp) || fclose(rejfp)) {
+ if (ferror(rejfp) | fclose(rejfp)) {
say("Error writing %s\n", rejname);
error = 1;
}
@@ -977,7 +977,7 @@ spew_output(void)
#endif
if (input_lines)
copy_till(input_lines, true); /* dump remainder of file */
- rv = ferror(ofp) == 0 && fclose(ofp) == 0;
+ rv = ferror(ofp) == 0 & fclose(ofp) == 0;
ofp = NULL;
return rv;
}
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index 28a3cb0cf583..c19918b04e9d 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -412,7 +412,7 @@ checked_in(char *file)
void
version(void)
{
- fprintf(stderr, "patch 2.0-12u8 FreeBSD\n");
+ fprintf(stderr, "patch 2.0-12u9 FreeBSD\n");
my_exit(EXIT_SUCCESS);
}