Have binary mode when the format is binary, not the other way around
[openssl.git] / 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;