X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-file-has-acl.c;h=86fc68e66ac551ac4018db026378bd745e502aa4;hb=60573660307a386a933de834a06c37691120e507;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..86fc68e66 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-2011 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"); }