summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-07-25 15:23:59 +0000
committerJim Meyering <jim@meyering.net>2006-07-25 15:23:59 +0000
commit3a208b14048121755eb01377f985372561a4b953 (patch)
tree4d8ca5fb2a8484f893b0943fe636fca4ae1aa0f7 /src
parenta321dfb09d5bdf5a5b2bd91db42d0ea51b29972e (diff)
downloadcoreutils-3a208b14048121755eb01377f985372561a4b953.tar.xz
* src/ls.c (gobble_file): Make it so failure to stat a
non-command-line file provokes an exit status of 1, not 0. Say "cannot access" rather than "cannot stat". * tests/ls/stat-failed: New file/test, for the above. * tests/ls/Makefile.am (TESTS): Add stat-failed.
Diffstat (limited to 'src')
-rw-r--r--src/ls.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ls.c b/src/ls.c
index 457256d5b..64411d19e 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2611,14 +2611,13 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
f->stat_failed = (err < 0);
if (f->stat_failed)
{
- /* We treat stat failures for files the user named special.
- There is no guarantee that these files really exist so
- we do not print any information. */
+ /* Failure to stat a command line argument leads to
+ an exit status of 2. For other files, stat failure
+ provokes an exit status of 1. */
+ file_failure (command_line_arg,
+ _("cannot access %s"), absolute_name);
if (command_line_arg)
- {
- file_failure (1, "%s", absolute_name);
- return 0;
- }
+ return 0;
f->filetype = type;
memset (&f->stat, '\0', sizeof (f->stat));