config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit d816dcf2bd9d4b62364564dc1d6fd5457ce3c89e
parent 501670bede4790530f39e202e866fd4db60f803d
Author: Jacob R. Edwards <n/a>
Date:   Fri,  5 Nov 2021 13:56:09 -0700

Don't print files which are already linked

Diffstat:
Mlib/module.c | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/lib/module.c b/lib/module.c @@ -175,18 +175,20 @@ usage: status = mkdir(new, ent->fts_statp->st_mode); break; case FTS_F: - if (errno == ENOENT) { - status = action(ent->fts_accpath, new); - } else if (action == link && st.st_ino == ent->fts_statp->st_ino) { + if (errno != ENOENT && action == link && st.st_ino == ent->fts_statp->st_ino) ; - } else if (force) { - status = (unlink(new) || action(ent->fts_accpath, new)); - } else if (action != none) { - errno = EEXIST; - status = 1; + else { + if (errno == ENOENT) + status = action(ent->fts_accpath, new); + else if (force) + status = (unlink(new) || action(ent->fts_accpath, new)); + else if (action != none) { + errno = EEXIST; + status = 1; + } + if (!status) + puts(new); } - if (!status) - puts(new); break; default: fprintf(stderr, "%s: Not a regular file.\n", ent->fts_path);