]> granicus.if.org Git - recode/commitdiff
Deference symlinked input files (fix Debian bug #349477)
authorReuben Thomas <rrt@sc3d.org>
Thu, 18 Jan 2018 00:18:33 +0000 (00:18 +0000)
committerReuben Thomas <rrt@sc3d.org>
Tue, 23 Jan 2018 07:02:42 +0000 (07:02 +0000)
bootstrap.conf
lib/.gitignore
m4/.gitignore
src/main.c

index bd0444065b90054f56912f9e976aa0d37bde4701..08f030ec8cceacfb077fdd7849c360cfc47c9008 100644 (file)
@@ -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
index 4901b2eed23ddc00bf9084dd879ae7599781e05d..1246175f426e9b055e0a0064109eec479b48ae5a 100644 (file)
 /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
index bef40ae43505974cd63d1053459a2c2856aed6d2..a6476cb5c6b435f6977015ae39c8c77b2ccbd6d9 100644 (file)
@@ -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
index 6bccfc04e543e6b28837145664931f1fef7fabbe..92f60419609f64b3cbec5d61ba59108db47340ac 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "common.h"
 
+#include <stdlib.h>
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -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.  */