From e3cfef7f99cdecd072829003ef5eb5aa92ea23f1 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Mon, 26 Apr 2010 19:01:08 +0200 Subject: 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. --- src/patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/patch.c') 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)) -- cgit v1.2.1