git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joachim Schmitz" <jojo@schmitz-digital.de>
To: git@vger.kernel.org
Subject: Re: [PATCH v3 1/4] poll() exits too early with EFAULT if 1st arg is NULL
Date: Thu, 13 Sep 2012 09:15:44 +0200	[thread overview]
Message-ID: <k2s177$l37$1@ger.gmane.org> (raw)
In-Reply-To: k2n79l$s9e$1@ger.gmane.org

Joachim Schmitz wrote:
> Joachim Schmitz wrote:
>> If poll() is used as a milli-second sleep, like in help.c, by passing
>> a NULL in the 1st and a 0 in the 2nd arg, it exits with EFAULT.
>> 
>> As per Paolo Bonzini, the original author, this is a bug and to be
>> fixed like in this commit, which is not to exit if the 2nd arg is 0.
>> 
>> Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>
>> ---
>> compat/win32/poll.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/compat/win32/poll.c b/compat/win32/poll.c
>> index 403eaa7..9e7a25c 100644
>> --- a/compat/win32/poll.c
>> +++ b/compat/win32/poll.c
>> @@ -349,7 +349,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int
>> timeout) 
>> 
>>   /* EFAULT is not necessary to implement, but let's do it in the
>>      simplest case. */
>> -  if (!pfd)
>> +  if (!pfd && nfd)
>>     {
>>       errno = EFAULT;
>>       return -1;
> 
> Actually this one is not needed for win32 (nor does win32 suffer from
> a similar bug), so should probably better get added after patch 2/2
> (or as part of it), the move to compat/poll/.

It just got added that was to gnulib, with a commit message of:

don't exit early if NULL is the 1st arg to poll(),
but nfd is 0.  In that case poll should behave like select.

Bye, Jojo

      reply	other threads:[~2012-09-13  7:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-07 12:52 [PATCH v3 1/4] poll() exits too early with EFAULT if 1st arg is NULL Joachim Schmitz
2012-09-11 11:28 ` Joachim Schmitz
2012-09-13  7:15   ` Joachim Schmitz [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='k2s177$l37$1@ger.gmane.org' \
    --to=jojo@schmitz-digital.de \
    --cc=git@vger.kernel.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).