runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 01f811082daa42b88668f09adddfa7df07aa3a40
parent b36a35a3da918de5f70b95af4a3f92cdd96b94c5
Author: Gerrit Pape <pape@smarden.org>
Date:   Tue,  2 Mar 2004 20:20:08 +0000

  * chpst.c: -e dir: silently ignore directories, print warning if verbose.

Diffstat:
Mpackage/CHANGES | 1+
Msrc/chpst.c | 14+++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/package/CHANGES b/package/CHANGES @@ -1,4 +1,5 @@ * fmt_ptime.c: create timestamps in UTC, not localtime. + * chpst.c: -e dir: silently ignore directories, print warning if verbose. runit 1.0.0 Tue, 10 Feb 2004 13:37:28 +0000 diff --git 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'))