1
0
Fork 0

Merging upstream version 1.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 18:44:28 +01:00
parent d24d609a01
commit a2dab4fd78
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
10 changed files with 48 additions and 39 deletions

7
main.c
View file

@ -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;