summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 14:00:38 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 14:00:38 +0000
commitc14d1693bdd22c33c4cf48acb77cf51b1769dc77 (patch)
treec6fd25510d2ff466252686512f69d8ca9ba155c8 /main.c
parentAdding debian version 1.5-1. (diff)
downloadlzlib-c14d1693bdd22c33c4cf48acb77cf51b1769dc77.tar.xz
lzlib-c14d1693bdd22c33c4cf48acb77cf51b1769dc77.zip
Merging upstream version 1.6~pre1.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/main.c b/main.c
index db94774..4435c01 100644
--- a/main.c
+++ b/main.c
@@ -54,6 +54,10 @@
#include "carg_parser.h"
#include "lzlib.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
#if CHAR_BIT != 8
#error "Environments where CHAR_BIT != 8 are not supported."
#endif
@@ -75,12 +79,6 @@ const char * const program_name = "minilzip";
const char * const program_year = "2013";
const char * invocation_name = 0;
-#ifdef O_BINARY
-const int o_binary = O_BINARY;
-#else
-const int o_binary = 0;
-#endif
-
struct { const char * from; const char * to; } const known_extensions[] = {
{ ".lz", "" },
{ ".tlz", ".tar" },
@@ -306,7 +304,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp
}
else
{
- infd = open( name, O_RDONLY | o_binary );
+ infd = open( name, O_RDONLY | O_BINARY );
if( infd < 0 )
{
if( verbosity >= 0 )
@@ -387,7 +385,7 @@ static void set_d_outname( const char * const name, const int i )
static bool open_outstream( const bool force )
{
- int flags = O_CREAT | O_WRONLY | o_binary;
+ int flags = O_CREAT | O_WRONLY | O_BINARY;
if( force ) flags |= O_TRUNC; else flags |= O_EXCL;
outfd = open( output_filename, flags, outfd_mode );