fixed regression where df -l <device> as regular user cause Permission

denied (#520630, introduced by fix for rhbz #497830)
This commit is contained in:
Ondrej Vasik 2009-09-03 15:19:58 +00:00
parent 79c2ad7ebe
commit 2c2fd97500
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,17 @@
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;

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 7.5
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -25,6 +25,7 @@ Patch2: coreutils-7.5-ls-inode.patch
Patch100: coreutils-6.10-configuration.patch
Patch101: coreutils-6.10-manpages.patch
Patch102: coreutils-7.4-sttytcsadrain.patch
Patch103: coreutils-7.5-df-localdevice.patch
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@ -116,6 +117,7 @@ Libraries for coreutils package.
%patch100 -p1 -b .configure
%patch101 -p1 -b .manpages
%patch102 -p1 -b .tcsadrain
%patch103 -p1 -b .localdevice
# sh-utils
%patch703 -p1 -b .dateman
@ -331,6 +333,11 @@ fi
%{_libdir}/coreutils
%changelog
* Thu Sep 03 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-4
- fixed regression where df -l <device> as regular user
cause "Permission denied" (#520630, introduced by fix for
rhbz #497830)
* Fri Aug 28 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-3
- ls -i: print consistent inode numbers also for mount points
(#453709)