{
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);
#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)
if (fp == NULL)
goto err;
bflags = BIO_CLOSE;
- if (!binmode)
+ if (textmode)
bflags |= BIO_FP_TEXT;
b = BIO_new_fp(fp, bflags);
if (b)