Have binary mode when the format is binary, not the other way around
authorRichard Levitte <levitte@openssl.org>
Fri, 4 Sep 2015 13:17:29 +0000 (15:17 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 5 Sep 2015 23:35:54 +0000 (01:35 +0200)
Fixing a small mixup.

Reviewed-by: Tim Hudson <tjh@openssl.org>
apps/openssl.c

index 7e340be21ab987c14de398a8cd0f585c7e51e9ea..bfd77a55b47f13e128b6b4f53600b8406e475615 100644 (file)
@@ -305,11 +305,11 @@ static const char *modestr(char mode, int format)
 
     switch (mode) {
     case 'a':
 
     switch (mode) {
     case 'a':
-        return (format) & B_FORMAT_TEXT ? "ab" : "a";
+        return (format & B_FORMAT_TEXT) ? "a" : "ab";
     case 'r':
     case 'r':
-        return (format) & B_FORMAT_TEXT ? "rb" : "r";
+        return (format & B_FORMAT_TEXT) ? "r" : "rb";
     case 'w':
     case 'w':
-        return (format) & B_FORMAT_TEXT ? "wb" : "w";
+        return (format & B_FORMAT_TEXT) ? "w" : "wb";
     }
     /* The assert above should make sure we never reach this point */
     return NULL;
     }
     /* The assert above should make sure we never reach this point */
     return NULL;