X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=tests%2Ftest-file-has-acl.c;h=7afd3bb2445676d46e5c2e7298f3d3aaa3c2c2d4;hb=2d91a71b4af88ffea2bf5cf9a18e2f803ecba537;hp=daab4dbd9fc2e88461ac80fc80514ad409f32a39;hpb=456355401219fdc2cb203baedd2bf176572e8310;p=gnulib.git diff --git a/tests/test-file-has-acl.c b/tests/test-file-has-acl.c index daab4dbd9..7afd3bb24 100644 --- a/tests/test-file-has-acl.c +++ b/tests/test-file-has-acl.c @@ -1,5 +1,5 @@ /* Test for presence of ACL. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2012 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 @@ -20,23 +20,14 @@ #include "acl.h" +#include #include #include #include #include #include -#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[]) @@ -54,13 +45,21 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } + /* Check against possible infinite loop in file_has_acl. */ +#if HAVE_DECL_ALARM + /* Declare failure if test takes too long, by using default abort + caused by SIGALRM. */ + signal (SIGALRM, SIG_DFL); + alarm (5); +#endif + #if USE_ACL { 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"); }