summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-06 11:28:53 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-06 11:28:53 +0000
commita3629922528ef8b10b664add82a8d5a1d26712b1 (patch)
treef7a142116cac25055205729fbf1c17f76066b351 /main.c
parentAdding upstream version 1.0~rc3. (diff)
downloadclzip-a3629922528ef8b10b664add82a8d5a1d26712b1.tar.xz
clzip-a3629922528ef8b10b664add82a8d5a1d26712b1.zip
Adding upstream version 1.0.upstream/1.0
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'main.c')
-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;