Skip to content

Commit

Permalink
base64: setmode(O_BINARY)
Browse files Browse the repository at this point in the history
  • Loading branch information
aklomp committed Jan 29, 2024
1 parent e940861 commit 9f32afc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
// Include the Windows API.
#ifdef WIN
# include <windows.h>
# include <io.h>
# include <fcntl.h>
#endif

#include "../include/libbase64.h"
Expand Down Expand Up @@ -359,10 +361,9 @@ encode_inner (const struct config *config, struct buffer *buf)
static bool
encode (const struct config *config, struct buffer *buf)
{
if (freopen(NULL, "wb", stdout) == 0) {
fprintf(stderr, "freopen(stdout)\n");
return false;
}
#ifdef WIN
_setmode(1, _O_BINARY);
#endif

const bool ret = encode_inner(config, buf);

Expand Down

0 comments on commit 9f32afc

Please sign in to comment.