From f143e27669535d7b4aa2566a573ee7eaa4595544 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Thu, 18 Jan 2018 00:18:33 +0000 Subject: [PATCH] Deference symlinked input files (fix Debian bug #349477) --- bootstrap.conf | 3 ++- lib/.gitignore | 10 ++++++++++ m4/.gitignore | 7 +++++++ src/main.c | 6 +++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index bd04440..08f030e 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -1,4 +1,4 @@ -# bootstrap.conf (Recode) version 2018-01-15 +# bootstrap.conf (Recode) version 2018-01-17 # This file is part of Recode. # @@ -49,6 +49,7 @@ gnulib_tool_options=' gnulib_modules=' argmatch bootstrap + canonicalize-lgpl error getopt-posix gettext-h diff --git a/lib/.gitignore b/lib/.gitignore index 4901b2e..1246175 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -149,3 +149,13 @@ /xsize.c /xsize.h /unused-parameter.h +/canonicalize-lgpl.c +/lstat.c +/readlink.c +/stat-time.c +/stat-time.h +/stat-w32.c +/stat-w32.h +/stat.c +/sys_stat.in.h +/sys/stat.h diff --git a/m4/.gitignore b/m4/.gitignore index bef40ae..a6476cb 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -122,3 +122,10 @@ gnulib-comp.m4 /wchar_t.m4 /wint_t.m4 /xsize.m4 +/canonicalize.m4 +/largefile.m4 +/lstat.m4 +/readlink.m4 +/stat-time.m4 +/stat.m4 +/sys_stat_h.m4 diff --git a/src/main.c b/src/main.c index 6bccfc0..92f6041 100644 --- a/src/main.c +++ b/src/main.c @@ -18,6 +18,7 @@ #include "common.h" +#include #include #include #include @@ -810,7 +811,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), struct stat file_stat; struct utimbuf file_utime; - input_name = argv[optind]; + input_name = realpath (argv[optind], NULL); + if (input_name == NULL) + error (EXIT_FAILURE, errno, "realpath (%s)", argv[optind]); + output_name = xmalloc (strlen (input_name) + 17 + 1); /* 17 is upper limit for rec%d.tmp where %d is pid_t */ /* Check if the file can be read and rewritten. */ -- 2.40.0