summaryrefslogtreecommitdiff
path: root/src/patch.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2010-04-26 19:01:08 +0200
committerAndreas Gruenbacher <agruen@suse.de>2010-04-27 12:38:15 +0200
commite3cfef7f99cdecd072829003ef5eb5aa92ea23f1 (patch)
tree09a72fa92c7ae1af67eeb43c8a5f1526f70f32f0 /src/patch.c
parentf558fff53365dd4fb315966f059160d3d2ece603 (diff)
downloadpatch-e3cfef7f99cdecd072829003ef5eb5aa92ea23f1.tar.gz
Refuse to patch symlinks
* src/inp.c (get_input_file), src/pch.c (there_is_another_patch, intuit_diff_type): Use lstat instead of stat. This causes patch to refuse patching symlinks (get_input_file() will refuse to read them). * src/util.c (create_backup): Refuse to create backups of symlinks. * tests/symlinks: New test case. * tests/Makefile.am (TESTS): Add test case. * bootstrap.conf: Use the gnulib lstat module.
Diffstat (limited to 'src/patch.c')
-rw-r--r--src/patch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/patch.c b/src/patch.c
index f3415dc..158cfcd 100644
--- a/src/patch.c
+++ b/src/patch.c
@@ -479,7 +479,7 @@ main (int argc, char **argv)
struct stat oldst;
int olderrno;
- olderrno = stat (rej, &oldst) ? errno : 0;
+ olderrno = lstat (rej, &oldst) ? errno : 0;
if (olderrno && olderrno != ENOENT)
write_fatal ();
if (! olderrno && file_already_seen (&oldst))