Example #1
0
int
main (int argc, char *argv[])
{
  const char *file;
  struct stat statbuf;

  ASSERT (argc == 2);

  file = argv[1];

  if (stat (file, &statbuf) < 0)
    {
      fprintf (stderr, "could not access file \"%s\"\n", file);
      exit (EXIT_FAILURE);
    }

#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);
      }
    printf ("%s\n", ret ? "yes" : "no");
  }
#else
  printf ("no\n");
#endif

  return 0;
}
Example #2
0
int
main (int argc, char *argv[])
{
  const char *file;
  struct stat statbuf;

  ASSERT (argc == 2);

  file = argv[1];

  if (stat (file, &statbuf) < 0)
    {
      fprintf (stderr, "could not access file \"%s\"\n", file);
      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.  */
  {
    int alarm_value = 5;
    signal (SIGALRM, SIG_DFL);
    alarm (alarm_value);
  }
#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);
      }
    printf ("%s\n", ret ? "yes" : "no");
  }
#else
  printf ("no\n");
#endif

  return 0;
}