git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	Vincent van Ravesteijn <vfr@lyx.org>,
	git@vger.kernel.org, msysgit@googlegroups.com,
	kusmabite@gmail.com, Johannes.Schindelin@gmx.de
Subject: Re: [msysGit] Re: [PATCH 1/2] MSVC: Do not close stdout to prevent a crash
Date: Sun, 20 Nov 2011 10:27:26 +0100	[thread overview]
Message-ID: <4EC8C7FE.5050903@kdbg.org> (raw)
In-Reply-To: <7vpqgniid5.fsf@alter.siamese.dyndns.org>

Am 20.11.2011 04:27, schrieb Junio C Hamano:
> Andreas Schwab <schwab@linux-m68k.org> writes:
> 
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>>> We have relied on fstat(-1, &st) to correctly error out, and if MSVC build
>>> crashes, it is a bug in its fstat() emulation, I would think.
>>
>> fileno(stdout) is alread wrong if stdout was closed.
> 
> The "-1" in my message comes from here:
> 
>     DESCRIPTION
> 
>     The fileno() function shall return the integer file descriptor
>     associated with the stream pointed to by stream.
> 
>     RETURN VALUE
> 
>     Upon successful completion, fileno() shall return the integer value of
>     the file descriptor associated with stream. Otherwise, the value -1
>     shall be returned and errno set to indicate the error.

But in the description of fclose() there is also:

  After the call to fclose(), any use of stream results in undefined
  behavior.

And we do call fclose(stdout) in cmd_format_patch.

-- Hannes

  parent reply	other threads:[~2011-11-20  9:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-19 13:45 [PATCH 1/2] MSVC: Do not close stdout to prevent a crash Vincent van Ravesteijn
2011-11-19 13:52 ` [PATCH 2/2] MSVC: Use _putenv instead of putenv " Vincent van Ravesteijn
2011-11-19 14:41 ` [PATCH 1/2] MSVC: Do not close stdout " Andreas Schwab
2011-11-19 19:11   ` Junio C Hamano
2011-11-19 20:16     ` Andreas Schwab
2011-11-20  3:27       ` Junio C Hamano
2011-11-20  9:05         ` Andreas Schwab
2011-11-20  9:27         ` Johannes Sixt [this message]
2011-11-20 21:10           ` [msysGit] " Junio C Hamano
2011-11-19 20:52     ` Vincent van Ravesteijn
2011-11-19 20:11 ` [msysGit] " Johannes Sixt
2011-11-22  6:45   ` Vincent van Ravesteijn
2011-11-22 20:24     ` Johannes Sixt
2011-11-22 21:27       ` Vincent van Ravesteijn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EC8C7FE.5050903@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kusmabite@gmail.com \
    --cc=msysgit@googlegroups.com \
    --cc=schwab@linux-m68k.org \
    --cc=vfr@lyx.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).