bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: interix 3.5 select bug


From: Jim Meyering
Subject: Re: interix 3.5 select bug
Date: Wed, 11 Mar 2009 13:49:02 +0100

Pádraig Brady wrote:
> Markus Duft wrote:
>> Hi!
>>
>> I have a more or less trivial patch for the nanosleep replacement for
>> interix. The problem I ran into is, that select() has a bug, making it fail
>> with "bad address" if the number of fd's to select on is zero. Setting the
>> set-size to 1 solves the problem, and should not damage anything else around
>> there, since all the sets are NULL anyway.
>>
>> The patch can be found here:
>> http://tinderbox.dev.gentoo.org/portage-prefix/sys-apps/coreutils/files/coreutils-6.12-interix-sleep.patch
>>
>> If you need more info, please contact me.
>>
>> Cheers, Markus Duft
>
> That looks fine as the first param to select
> is the highest-numbered file descriptor + 1.
> Arguably 1 is more correct than 0.
>
> Note this function is now part of gnulib (CCd).

Thanks for looking at that, Pádraig.
I agree.

Note that there are other uses of select with 0 as first argument.
These affect the poll ans select modules:

    $ git grep -l 'select (0'
    lib/poll.c
    lib/winsock-select.c

Markus, I'll push this in your name, assuming you're the one who wrote it.
If not, please let me know.

>From e90e830bdcff62781e3d7f0bce3dc9488db2c107 Mon Sep 17 00:00:00 2001
From: Markus Duft <address@hidden>
Date: Wed, 11 Mar 2009 13:47:22 +0100
Subject: [PATCH] * lib/nanosleep.c (my_usleep): Use 1, not 0, as the first 
argument.

This avoids a failure on Interix 3.5.  Details in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/16077
---
 ChangeLog       |    6 ++++++
 lib/nanosleep.c |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3754d34..a1211af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-11  Markus Duft  <address@hidden>
+
+       * lib/nanosleep.c (my_usleep): Use 1, not 0, as the first argument.
+       This avoids a failure on Interix 3.5.  Details in
+       http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/16077
+
 2009-03-10  Bruno Haible  <address@hidden>

        Tests for module 'mbmemcasecoll'.
diff --git a/lib/nanosleep.c b/lib/nanosleep.c
index 7a7cc02..ed32c99 100644
--- a/lib/nanosleep.c
+++ b/lib/nanosleep.c
@@ -132,7 +132,7 @@ my_usleep (const struct timespec *ts_delay)
          tv_delay.tv_usec = 0;
        }
     }
-  select (0, NULL, NULL, NULL, &tv_delay);
+  select (1, NULL, NULL, NULL, &tv_delay);
 }

 /* Suspend execution for at least *REQUESTED_DELAY seconds.  The
--
1.6.2.rc1.285.gc5f54




reply via email to

[Prev in Thread] Current Thread [Next in Thread]