Skip to content

Commit a16753d

Browse files
j6tgitster
authored andcommitted
test-genrandom: ensure stdout is set to _O_BINARY on Windows
Commit a6ca8c6 (Set _O_BINARY as default fmode for both MinGW and MSVC) removed the definition of _CRT_fmode from mingw.c. Before this commit, since test-genrandom is linked against libgit.a, the MinGW process initialization code would pick up that definition of _CRT_fmode, which was initialized to _O_BINARY. After this commit, however, text mode is used for std(in|out|err) because it is the default in absence of _CRT_fmode. In order to fix that, we must use git-compat-util.h, which overrides main() to set the mode to binary. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0984e3a commit a16753d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

test-genrandom.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
* Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.
55
*/
66

7-
#include <stdio.h>
8-
#include <stdlib.h>
7+
#include "git-compat-util.h"
98

109
int main(int argc, char *argv[])
1110
{

0 commit comments

Comments
 (0)