bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] mktime & nanosleep: make sure SIGALRM is not blocked


From: Mike Frysinger
Subject: Re: [PATCH] mktime & nanosleep: make sure SIGALRM is not blocked
Date: Tue, 19 May 2009 00:44:15 -0400
User-agent: KMail/1.11.3 (Linux/2.6.29.2; KDE/4.2.3; x86_64; ; )

On Monday 18 May 2009 23:38:13 Eric Blake wrote:
> According to Mike Frysinger on 5/18/2009 9:11 PM:
> > @@ -170,6 +170,10 @@ main ()
> >    /* This test makes some buggy mktime implementations loop.
> >       Give up after 60 seconds; a mktime slower than that
> >       isn't worth using anyway.  */
> > +  sigset_t set;
> > +  sigemptyset (&set);
> > +  sigaddset (&set, SIGALRM);
> > +  sigprocmask (SIG_UNBLOCK, &set, NULL);
> >    alarm (60);
>
> This won't work on platforms that have signal() but not sigprocmask().
> Let's just reuse the test already present in other timeout situations,
> such as in m4/strstr.m4.
>
> ...
>     [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
> #include <signal.h> /* for signal */
> #include <string.h> /* for memmem */
> #include <stdlib.h> /* for malloc */
> #include <unistd.h> /* for alarm */
> ]], [[size_t m = 1000000;
>     char *haystack = (char *) malloc (2 * m + 2);
>     char *needle = (char *) malloc (m + 2);
>     void *result = 0;
>     /* Failure to compile this test due to missing alarm is okay,
>        since all such platforms (mingw) also have quadratic strstr.  */
>     signal (SIGALRM, SIG_DFL);
>     alarm (5);
> ...

i dont see how this is relevant.  this code is doing the same thing as the 
existing nanosleep/mktime cases: only setting the signal handler.  it doesnt 
affect the blocked signal mask which means SIGALRM still wont be delivered.  
or i'm missing some nuance in the spec definition of signal() ...
-mike




reply via email to

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