1
0
Fork 0

Merging upstream version 1.17~rc2.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-21 11:24:05 +01:00
parent 93ad4e56ce
commit 36c7129c83
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
12 changed files with 126 additions and 100 deletions

24
main.cc
View file

@ -372,14 +372,14 @@ void cleanup_and_fail( const int retval )
}
// Set permissions, owner and times.
/* Set permissions, owner and times. */
void close_and_set_permissions( const struct stat * const in_statsp )
{
bool warning = false;
if( in_statsp )
{
const mode_t mode = in_statsp->st_mode;
// fchown will in many cases return with EPERM, which can be safely ignored.
/* fchown will in many cases return with EPERM, which can be safely ignored. */
if( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) == 0 )
{ if( fchmod( outfd, mode ) != 0 ) warning = true; }
else
@ -579,14 +579,6 @@ void show_error( const char * const msg, const int errcode, const bool help )
}
void show_error2( const char * const msg1, const char * const name,
const char * const msg2 )
{
if( verbosity >= 0 )
std::fprintf( stderr, "%s: %s '%s' %s\n", program_name, msg1, name, msg2 );
}
void internal_error( const char * const msg )
{
if( verbosity >= 0 )
@ -595,6 +587,14 @@ void internal_error( const char * const msg )
}
void show_error2( const char * const msg1, const char * const name,
const char * const msg2 )
{
if( verbosity >= 0 )
std::fprintf( stderr, "%s: %s '%s' %s\n", program_name, msg1, name, msg2 );
}
int main( const int argc, const char * const argv[] )
{
Block range( 0, 0 );
@ -642,7 +642,7 @@ int main( const int argc, const char * const argv[] )
for( ; argind < parser.arguments(); ++argind )
{
const int code = parser.code( argind );
if( !code ) break; // no more options
if( !code ) break; /* no more options */
const std::string & arg = parser.argument( argind );
switch( code )
{
@ -670,7 +670,7 @@ int main( const int argc, const char * const argv[] )
parse_pos_value( arg.c_str(), bad_pos, bad_value ); break;
default : internal_error( "uncaught option." );
}
} // end process options
} /* end process options */
#if defined(__MSVCRT__) || defined(__OS2__)
setmode( STDIN_FILENO, O_BINARY );