From ac24e2c9fbde52438e7f0a07e243069dc9859652 Mon Sep 17 00:00:00 2001 From: Ian Nartowicz Date: Fri, 30 May 2014 20:42:24 +0100 Subject: Preserve file permissions --- plugins/vorbis/vcedit.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins') diff --git a/plugins/vorbis/vcedit.c b/plugins/vorbis/vcedit.c index 5709f89c..00a3a47f 100644 --- a/plugins/vorbis/vcedit.c +++ b/plugins/vorbis/vcedit.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include "vcedit.h" @@ -220,6 +221,11 @@ off_t vcedit_write_metadata(DB_FILE *in, const char *fname, int link, const char *lasterror = "file not opened for reading."; goto cleanup; } + struct stat stat_struct; + if (stat(fname, &stat_struct) || chmod(outname, stat_struct.st_mode)) { + *lasterror = "cannot transfer file permissions."; + goto cleanup; + } /* Copy through pages until we reach the right info header */ int codec_serial = 0; -- cgit v1.2.3 From 218751d661d80fe18cef441d4a3abbd553ce7f40 Mon Sep 17 00:00:00 2001 From: Ian Nartowicz Date: Fri, 30 May 2014 22:01:09 +0100 Subject: Just ignore a failed stat --- plugins/vorbis/vcedit.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/vorbis/vcedit.c b/plugins/vorbis/vcedit.c index 00a3a47f..2f30aeb6 100644 --- a/plugins/vorbis/vcedit.c +++ b/plugins/vorbis/vcedit.c @@ -222,10 +222,8 @@ off_t vcedit_write_metadata(DB_FILE *in, const char *fname, int link, const char goto cleanup; } struct stat stat_struct; - if (stat(fname, &stat_struct) || chmod(outname, stat_struct.st_mode)) { - *lasterror = "cannot transfer file permissions."; - goto cleanup; - } + if (!stat(fname, &stat_struct)) + chmod(outname, stat_struct.st_mode); /* Copy through pages until we reach the right info header */ int codec_serial = 0; -- cgit v1.2.3