Rename binmode into textmode and use it correctly
authorRichard Levitte <levitte@openssl.org>
Thu, 14 Jan 2016 13:07:57 +0000 (14:07 +0100)
committerRichard Levitte <levitte@openssl.org>
Thu, 14 Jan 2016 13:07:57 +0000 (14:07 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
apps/apps.c

index 685536a4344152f6093fd3c2bba2497b010565fd..43a51f63aed7f9b36a9d0ad3e6565dcd36972cda 100644 (file)
@@ -2796,7 +2796,7 @@ BIO *bio_open_owner(const char *filename, int format, int private)
 {
     FILE *fp = NULL;
     BIO *b = NULL;
 {
     FILE *fp = NULL;
     BIO *b = NULL;
-    int fd = -1, bflags, mode, binmode;
+    int fd = -1, bflags, mode, textmode;
 
     if (!private || filename == NULL || strcmp(filename, "-") == 0)
         return bio_open_default(filename, 'w', format);
 
     if (!private || filename == NULL || strcmp(filename, "-") == 0)
         return bio_open_default(filename, 'w', format);
@@ -2808,8 +2808,8 @@ BIO *bio_open_owner(const char *filename, int format, int private)
 #ifdef O_TRUNC
     mode |= O_TRUNC;
 #endif
 #ifdef O_TRUNC
     mode |= O_TRUNC;
 #endif
-    binmode = istext(format);
-    if (binmode) {
+    textmode = istext(format);
+    if (!textmode) {
 #ifdef O_BINARY
         mode |= O_BINARY;
 #elif defined(_O_BINARY)
 #ifdef O_BINARY
         mode |= O_BINARY;
 #elif defined(_O_BINARY)
@@ -2824,7 +2824,7 @@ BIO *bio_open_owner(const char *filename, int format, int private)
     if (fp == NULL)
         goto err;
     bflags = BIO_CLOSE;
     if (fp == NULL)
         goto err;
     bflags = BIO_CLOSE;
-    if (!binmode)
+    if (textmode)
         bflags |= BIO_FP_TEXT;
     b = BIO_new_fp(fp, bflags);
     if (b)
         bflags |= BIO_FP_TEXT;
     b = BIO_new_fp(fp, bflags);
     if (b)