From: Reuben Thomas Date: Tue, 16 Jan 2018 00:23:58 +0000 (+0000) Subject: Don’t insist on chmod succeeding for output files X-Git-Tag: v3.7~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6b9b084dbb413491baae75111ca0df4f852f411;p=recode Don’t insist on chmod succeeding for output files Support file systems that lack permissions (e.g. FAT). Fixes Debian bug #237249. --- diff --git a/src/main.c b/src/main.c index 9a264c7..6bccfc0 100644 --- a/src/main.c +++ b/src/main.c @@ -878,10 +878,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), if (unlink (input_name) < 0) error (EXIT_FAILURE, errno, "unlink (%s)", input_name); - /* Preserve the file permissions. */ + /* Preserve the file permissions if possible. */ + + chmod (output_name, file_stat.st_mode & 07777); - if (chmod (output_name, file_stat.st_mode & 07777) < 0) - error (EXIT_FAILURE, errno, "chmod (%s)", output_name); if (rename (output_name, input_name) < 0) error (EXIT_FAILURE, errno, "rename (%s, %s)", output_name, input_name);