summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-06 11:29:00 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-06 11:29:00 +0000
commitee4373742b5e806cf3fb080808a2061c5644a14d (patch)
tree65e45e9ae8579bb28d83a8c881238fb614b2ad53 /main.c
parentAdding debian version 1.0~rc3-1. (diff)
downloadclzip-ee4373742b5e806cf3fb080808a2061c5644a14d.tar.xz
clzip-ee4373742b5e806cf3fb080808a2061c5644a14d.zip
Merging upstream version 1.0.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r--main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.c b/main.c
index 77cb1f6..167c2b7 100644
--- a/main.c
+++ b/main.c
@@ -82,6 +82,7 @@ enum Mode { m_compress = 0, m_decompress, m_test };
char * output_filename = 0;
int outfd = -1;
+mode_t outfd_mode = S_IRUSR | S_IWUSR;
bool delete_output_on_interrupt = false;
@@ -320,8 +321,7 @@ static bool open_outstream( const bool force )
int flags = O_CREAT | O_WRONLY | o_binary;
if( force ) flags |= O_TRUNC; else flags |= O_EXCL;
- outfd = open( output_filename, flags,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );
+ outfd = open( output_filename, flags, outfd_mode );
if( outfd < 0 )
{
if( errno == EEXIST ) outfd = -2; else outfd = -1;
@@ -600,6 +600,7 @@ void cleanup_and_fail( const int retval )
{
if( delete_output_on_interrupt )
{
+ delete_output_on_interrupt = false;
if( verbosity >= 0 )
fprintf( stderr, "%s: Deleting output file `%s', if it exists.\n",
program_name, output_filename );
@@ -831,6 +832,7 @@ int main( const int argc, const char * const argv[] )
strlen( default_output_filename ) + 1 );
strcpy( output_filename, default_output_filename );
}
+ outfd_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
if( !open_outstream( force ) )
{
if( outfd == -1 && retval < 1 ) retval = 1;
@@ -855,6 +857,7 @@ int main( const int argc, const char * const argv[] )
if( program_mode == m_compress )
set_c_outname( input_filename, volume_size != LLONG_MAX );
else set_d_outname( input_filename, eindex );
+ outfd_mode = S_IRUSR | S_IWUSR;
if( !open_outstream( force ) )
{
if( outfd == -1 && retval < 1 ) retval = 1;