All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: David Michael <fedora.dm0@gmail.com>
Cc: Duy Nguyen <pclouds@gmail.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] compat: convert modes to use portable file type values
Date: Mon, 01 Dec 2014 12:09:36 -0800	[thread overview]
Message-ID: <xmqq7fybp1xb.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAEvUa7nsz1UX5+qakPGW=wTR_VRJU3r+VkgVt9qiCDUz30MweA@mail.gmail.com> (David Michael's message of "Mon, 1 Dec 2014 14:10:36 -0500")

David Michael <fedora.dm0@gmail.com> writes:

>> Huh?  I am confused.  Since when is it legal to give NULL as statbuf
>> to (l)stat(2)?
>>
>> Wouldn't something like this be sufficient and necessary?
>>
>>         int rc = stat(path, buf);
>>         if (rc)
>>                 return rc;
>>
>> That is, let the underlying stat(2) diagnose any and all problems
>> (and leave clues in errno) and parrot its return value to the caller
>> to signal the failure?
>
> Alright, it wasn't immediately clear to me from the OpenGroup page on
> stat() if that would always be safe.  I will just test the return code
> in v2.

It is irrelevant if that is safe or not.  As long as we are
emulating the underlying stat(), whether it is unsafe for stat(), we
should just throw whatever the user throws at us at the underlying
stat() and let it behave as if our emulation layer were not there.

Which is what the above snippet does.

      reply	other threads:[~2014-12-01 20:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-30  2:41 [PATCH] compat: convert modes to use portable file type values David Michael
2014-11-30 20:16 ` Torsten Bögershausen
2014-12-01  3:40   ` David Michael
2014-12-01  5:55     ` Torsten Bögershausen
2014-12-01 12:48       ` David Michael
2014-12-01 17:46         ` David Michael
2014-12-01  3:11 ` Junio C Hamano
2014-12-01 14:44 ` Duy Nguyen
2014-12-01 17:49   ` David Michael
2014-12-01 17:57     ` Junio C Hamano
2014-12-01 19:10       ` David Michael
2014-12-01 20:09         ` Junio C Hamano [this message]

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=xmqq7fybp1xb.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=fedora.dm0@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.