From c845b66d8b17513b64acac9e74d20631a68e22b1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 7 Nov 2015 15:03:18 +0100 Subject: Merging upstream version 1.6~pre3. Signed-off-by: Daniel Baumann --- main.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index ef12c33..5c53b00 100644 --- a/main.c +++ b/main.c @@ -35,7 +35,7 @@ #include #include #include -#if defined(__MSVCRT__) +#if defined(__MSVCRT__) || defined(_MSC_VER) #include #define fchmod(x,y) 0 #define fchown(x,y,z) 0 @@ -202,9 +202,9 @@ static void show_help( void ) static void show_version( void ) { - printf( "%s %s\n", Program_name, PROGVERSION ); + printf( "%s %s\n", program_name, PROGVERSION ); printf( "Copyright (C) %s Antonio Diaz Diaz.\n", program_year ); - printf( "Using Lzlib %s\n", LZ_version() ); + printf( "Using lzlib %s\n", LZ_version() ); printf( "License GPLv3+: GNU GPL version 3 or later \n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" ); @@ -322,8 +322,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp } else { - do infd = open( name, O_RDONLY | O_BINARY ); - while( infd < 0 && errno == EINTR ); + infd = open( name, O_RDONLY | O_BINARY ); if( infd < 0 ) { if( verbosity >= 0 ) @@ -407,8 +406,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; - do outfd = open( output_filename, flags, outfd_mode ); - while( outfd < 0 && errno == EINTR ); + outfd = open( output_filename, flags, outfd_mode ); if( outfd < 0 && verbosity >= 0 ) { if( errno == EEXIST ) @@ -497,7 +495,7 @@ static int readblock( const int fd, uint8_t * const buf, const int size ) const int n = read( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; else if( n == 0 ) break; /* EOF */ - else if( errno != EINTR && errno != EAGAIN ) break; + else if( errno != EINTR ) break; errno = 0; } return size - rest; @@ -515,7 +513,7 @@ static int writeblock( const int fd, const uint8_t * const buf, const int size ) { const int n = write( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; - else if( n < 0 && errno != EINTR && errno != EAGAIN ) break; + else if( n < 0 && errno != EINTR ) break; errno = 0; } return size - rest; @@ -931,7 +929,7 @@ int main( const int argc, const char * const argv[] ) } } /* end process options */ -#if defined(__MSVCRT__) || defined(__OS2__) +#if defined(__MSVCRT__) || defined(__OS2__) || defined(_MSC_VER) setmode( STDIN_FILENO, O_BINARY ); setmode( STDOUT_FILENO, O_BINARY ); #endif -- cgit v1.2.3