summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2004-03-02 20:20:08 +0000
committerGerrit Pape <pape@smarden.org>2004-03-02 20:20:08 +0000
commitbd1dfa2184d4b7e91476c3d3755f8ebdb66d0ab3 (patch)
tree5610aa8edf0a783a1b3c7d9a25426df5a4cf9e6c /src
parent93a6a4f466c520a0b8ed4a69c98577d3e288517a (diff)
downloadrunit-bd1dfa2184d4b7e91476c3d3755f8ebdb66d0ab3.tar.gz
runit-bd1dfa2184d4b7e91476c3d3755f8ebdb66d0ab3.tar.xz
runit-bd1dfa2184d4b7e91476c3d3755f8ebdb66d0ab3.zip
* chpst.c: -e dir: silently ignore directories, print warning if verbose.
Diffstat (limited to 'src')
-rw-r--r--src/chpst.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/chpst.c b/src/chpst.c
index c89986d..fb96881 100644
--- a/src/chpst.c
+++ b/src/chpst.c
@@ -106,9 +106,17 @@ void edir(const char *dirname) {
       break;
     }
     if (d->d_name[0] == '.') continue;
-    if (openreadclose(d->d_name, &sa, 256) == -1)
-      strerr_die6sys(111, FATAL, "unable to read ", dirname, "/",
-		     d->d_name, ": ");
+    if (openreadclose(d->d_name, &sa, 256) == -1) {
+      if ((errno == error_isdir) && env_dir) {
+	if (verbose)
+	  strerr_warn6(WARNING, "unable to read ", dirname, "/",
+	               d->d_name, ": ", &strerr_sys);
+	continue;
+      }
+      else
+        strerr_die6sys(111, FATAL, "unable to read ", dirname, "/",
+	      	       d->d_name, ": ");
+    }
     if (sa.len) {
       sa.len =byte_chr(sa.s, sa.len, '\n');
       while (sa.len && (sa.s[sa.len -1] == ' ' || sa.s[sa.len -1] == '\t'))