git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joachim Schmitz" <jojo@schmitz-digital.de>
To: git@vger.kernel.org
Subject: [PATCH v6 3/4] poll() exits too early with EFAULT if 1st arg is NULL
Date: Mon, 17 Sep 2012 09:02:20 +0200	[thread overview]
Message-ID: <k36hu7$oaj$1@ger.gmane.org> (raw)
In-Reply-To: k36h3i$ihb$1@ger.gmane.org

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. It got fixed in
gnulib in the same manner the other day.

Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>
---
 compat/poll/poll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/poll/poll.c b/compat/win32/poll.c
index 403eaa7..9e7a25c 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/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;
-- 
1.7.12 

  parent reply	other threads:[~2012-09-17  7:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17  6:48 [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Joachim Schmitz
2012-09-17  6:53 ` [PATCH v6 1/4] make poll available for other platforms lacking it Joachim Schmitz
2012-09-17  6:56 ` [PATCH v6 2/4] fix some win32 specific dependencies in poll.c Joachim Schmitz
2012-09-17  7:02 ` Joachim Schmitz [this message]
2012-09-17  7:03 ` [PATCH v6 4/4] make poll() work on platforms that can't recv() on a non-socket Joachim Schmitz
2012-09-17 21:03 ` [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Junio C Hamano
2012-09-17 21:10   ` [PATCH v7 " Joachim Schmitz
2012-09-17 21:34     ` Joachim Schmitz
2012-09-17 22:38       ` Junio C Hamano
2012-09-18  6:22         ` Joachim Schmitz

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='k36hu7$oaj$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).