{"thread":{"id":"21013","subject":"[PATCH] test-genrandom: ensure stdout is set to _O_BINARY on Windows","startedAt":"2009-09-21T07:34:58Z","lastAt":"2009-09-21T07:36:34Z","messageCount":2,"participants":["Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"123560","messageId":"4AB72CA2.1020808@viscovery.net","threadId":"21013","inReplyTo":null,"subject":"[PATCH] test-genrandom: ensure stdout is set to _O_BINARY on Windows","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-09-21T07:34:58Z","receivedAt":"2009-09-21T07:34:58Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nCommit a6ca8c62 (Set _O_BINARY as default fmode for both MinGW and MSVC)\nremoved the definition of _CRT_fmode from mingw.c. Before this commit,\nsince test-genrandom is linked against libgit.a, the MinGW process\ninitialization code would pick up that definition of _CRT_fmode, which was\ninitialized to _O_BINARY. After this commit, however, text mode is used\nfor std(in|out|err) because it is the default in absence of _CRT_fmode.\nIn order to fix that, we must use git-compat-util.h, which overrides\nmain() to set the mode to binary.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n Unfortunately, this change in an updated patch 04/15 of the MSVC series\n went to the Big Void. ;)\n\n -- Hannes\n\n test-genrandom.c |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/test-genrandom.c b/test-genrandom.c\nindex 8ad276d..b3c28d9 100644\n--- a/test-genrandom.c\n+++ b/test-genrandom.c\n@@ -4,8 +4,7 @@\n  * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.\n  */\n\n-#include <stdio.h>\n-#include <stdlib.h>\n+#include \"git-compat-util.h\"\n\n int main(int argc, char *argv[])\n {\n-- \n1.6.5.rc1.1051.gdc4fd\n"},{"id":"123561","messageId":"7vws3svjel.fsf@alter.siamese.dyndns.org","threadId":"21013","inReplyTo":"4AB72CA2.1020808@viscovery.net","subject":"Re: [PATCH] test-genrandom: ensure stdout is set to _O_BINARY on Windows","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-21T07:36:34Z","receivedAt":"2009-09-21T07:36:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> From: Johannes Sixt <j6t@kdbg.org>\n>\n> Commit a6ca8c62 (Set _O_BINARY as default fmode for both MinGW and MSVC)\n> removed the definition of _CRT_fmode from mingw.c. Before this commit,\n> since test-genrandom is linked against libgit.a, the MinGW process\n> initialization code would pick up that definition of _CRT_fmode, which was\n> initialized to _O_BINARY. After this commit, however, text mode is used\n> for std(in|out|err) because it is the default in absence of _CRT_fmode.\n> In order to fix that, we must use git-compat-util.h, which overrides\n> main() to set the mode to binary.\n>\n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  Unfortunately, this change in an updated patch 04/15 of the MSVC series\n>  went to the Big Void. ;)\n\nThanks.\n"}]}