Blob Blame History Raw
diff -urNp coreutils-7.5-orig/src/df.c coreutils-7.5/src/df.c
--- coreutils-7.5-orig/src/df.c	2009-08-15 17:25:32.000000000 +0200
+++ coreutils-7.5/src/df.c	2009-09-03 16:37:25.000000000 +0200
@@ -995,7 +995,12 @@ main (int argc, char **argv)
       for (i = optind; i < argc; ++i)
 	{
 	  int fd = open (argv[i], O_RDONLY | O_NOCTTY);
-	  if (fd < 0 || fstat (fd, &stats[i - optind]))
+   if (0 <= fd && !fstat (fd, &stats[i - optind])
+       && !stat (argv[i], &stats[i - optind]))
+     {
+     /* open() may have failed for normal user but stat() works */
+     }
+   else
 	    {
 	      error (0, errno, "%s", quote (argv[i]));
 	      exit_status = EXIT_FAILURE;