This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix misc/tst-pselect.c


The testcase fails to build with:
tst-pselect.c: In function âdo_testâ:
tst-pselect.c:31: warning: âsigblockâ is deprecated (declared at ../signal/signal.h:181)
tst-pselect.c:39: warning: implicit declaration of function âpipeâ
tst-pselect.c:54: warning: implicit declaration of function âforkâ
tst-pselect.c:57: warning: implicit declaration of function âcloseâ
tst-pselect.c:81: warning: implicit declaration of function âTEMP_FAILURE_RETRYâ
tst-pselect.c:81: warning: implicit declaration of function âwriteâ
In file included from ../include/unistd.h:2,
                 from ../test-skeleton.c:29,
                 from tst-pselect.c:120:
../posix/unistd.h: At top level:
../posix/unistd.h:331: error: conflicting types for âwriteâ
tst-pselect.c:81: error: previous implicit declaration of âwriteâ was here
make[2]: *** [/builds/glibc/10.0-nptl/misc/tst-pselect.o] Error 1

Here's a fix which also avoids using sigblock.  

Ok to commit?

Andreas

2006-01-21  Andreas Jaeger  <aj@suse.de>

	* misc/tst-pselect.c: Include <unistd.h> for prototypes.
	(do_test): Use sigprocmask instead of sigblock.

============================================================
Index: misc/tst-pselect.c
--- misc/tst-pselect.c	21 Jan 2006 08:16:28 -0000	1.1
+++ misc/tst-pselect.c	21 Jan 2006 10:56:22 -0000
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <sys/select.h>
 #include <sys/wait.h>
+#include <unistd.h>
 
 
 static volatile int handler_called;
@@ -21,6 +22,7 @@ do_test (void)
   sa.sa_handler = handler;
   sa.sa_flags = 0;
   sigemptyset (&sa.sa_mask);
+  sigset_t signalset;
 
   if (sigaction (SIGUSR1, &sa, NULL) != 0)
     {
@@ -28,7 +30,10 @@ do_test (void)
       return 1;
     }
 
-  if (sigblock (SIGUSR1) != 0)
+  sigemptyset (&signalset);
+  sigaddset (&signalset, SIGUSR1);
+
+  if (sigprocmask (SIG_BLOCK, &signalset, NULL) != 0)
     {
       puts ("sigblock failed");
       return 1;

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj/
  SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 NÃrnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]