diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2010-04-26 18:20:25 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2010-04-27 12:38:15 +0200 |
commit | f558fff53365dd4fb315966f059160d3d2ece603 (patch) | |
tree | 83fb2980ff48548dac779a3d7f311ebaaff3534c | |
parent | 3aceaac3070bb4969e6bfd118061bc956385e288 (diff) | |
download | patch-f558fff53365dd4fb315966f059160d3d2ece603.tar.gz |
Only check for reversed patches when the input file is patchable
* src/pch.c (intuit_diff_type): Only check for reversed patches when
the input file is patchable in the first place.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/pch.c | 4 |
2 files changed, 6 insertions, 1 deletions
@@ -1,5 +1,8 @@ 2009-04-26 Andreas Gruenbacher <agruen@suse.de> + * src/pch.c (intuit_diff_type): Only check for reversed patches when + the input file is patchable in the first place. + * src/pch.c (get_input_file): If an input file is not a regular file, only skip the patch instead of aborting. * src/patch.c (main): If get_input_file() fails, skip the patch. @@ -713,6 +713,7 @@ intuit_diff_type (bool need_header) } if (i0 != NONE + && (i == NONE || S_ISREG (st[i].st_mode)) && maybe_reverse (p_name[i0], i == NONE, i == NONE || st[i].st_size == 0)) i = i0; @@ -747,7 +748,8 @@ intuit_diff_type (bool need_header) if (inname) { inerrno = stat (inname, &instat) == 0 ? 0 : errno; - maybe_reverse (inname, inerrno, inerrno || instat.st_size == 0); + if (inerrno || S_ISREG (instat.st_mode)) + maybe_reverse (inname, inerrno, inerrno || instat.st_size == 0); } else inerrno = -1; |