[gimp] Bug 776516 - Saving over existing GZ or BZ2 compressed files...



commit 559a75858105bdcc04f24899bba1ade79523f8ea
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jan 3 15:10:35 2017 +0100

    Bug 776516 - Saving over existing GZ or BZ2 compressed files...
    
    ...does not truncate them
    
    Pass O_TRUNC to g_open() when creating the target files.

 plug-ins/common/file-compressor.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/common/file-compressor.c b/plug-ins/common/file-compressor.c
index aec9a51..74afe2f 100644
--- a/plug-ins/common/file-compressor.c
+++ b/plug-ins/common/file-compressor.c
@@ -640,7 +640,7 @@ gzip_save (const char *infile,
   if (!in)
     goto out;
 
-  fd = g_open (outfile, O_CREAT | O_WRONLY | _O_BINARY, 0664);
+  fd = g_open (outfile, O_CREAT | O_WRONLY | O_TRUNC | _O_BINARY, 0664);
   if (fd == -1)
     goto out;
 
@@ -762,7 +762,7 @@ bzip2_save (const char *infile,
   if (!in)
     goto out;
 
-  fd = g_open (outfile, O_CREAT | O_WRONLY | _O_BINARY, 0664);
+  fd = g_open (outfile, O_CREAT | O_WRONLY | O_TRUNC | _O_BINARY, 0664);
   if (fd == -1)
     goto out;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]