gettimeofday: port recent C++ fix to Emacs
[gnulib.git] / tests / test-file-has-acl.c
index 5685f41..56cc3ba 100644 (file)
@@ -1,5 +1,5 @@
 /* Test for presence of ACL.
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2013 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 int
 main (int argc, char *argv[])
@@ -59,8 +49,11 @@ main (int argc, char *argv[])
 #if HAVE_DECL_ALARM
   /* Declare failure if test takes too long, by using default abort
      caused by SIGALRM.  */
-  signal (SIGALRM, SIG_DFL);
-  alarm (5);
+  {
+    int alarm_value = 5;
+    signal (SIGALRM, SIG_DFL);
+    alarm (alarm_value);
+  }
 #endif
 
 #if USE_ACL
@@ -68,8 +61,8 @@ main (int argc, char *argv[])
     int ret = file_has_acl (file, &statbuf);
     if (ret < 0)
       {
-       fprintf (stderr, "could not access the ACL of file \"%s\"\n", file);
-       exit (EXIT_FAILURE);
+        fprintf (stderr, "could not access the ACL of file \"%s\"\n", file);
+        exit (EXIT_FAILURE);
       }
     printf ("%s\n", ret ? "yes" : "no");
   }