careadlinkat: Clarify specification.
[gnulib.git] / tests / test-passfd.c
index 2048934..d657ad9 100644 (file)
@@ -19,6 +19,7 @@
 #include "passfd.h"
 
 #include <fcntl.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -40,6 +41,12 @@ main ()
   int fd;
   struct stat st;
 
+#if HAVE_DECL_ALARM
+  /* Avoid hanging on failure.  */
+  signal (SIGALRM, SIG_DFL);
+  alarm (5);
+#endif
+
   fdnull = open ("/dev/null", O_RDWR);
   if (fdnull < 0)
     {