diff options
Diffstat (limited to 'usr.sbin/mtree/verify.c')
-rw-r--r-- | usr.sbin/mtree/verify.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/usr.sbin/mtree/verify.c b/usr.sbin/mtree/verify.c index 25b33aa..d25797b 100644 --- a/usr.sbin/mtree/verify.c +++ b/usr.sbin/mtree/verify.c @@ -165,6 +165,7 @@ miss(p, tail) { register int create; register char *tp; + const char *type; for (; p; p = p->next) { if (p->type != F_DIR && (dflag || p->flags & F_VISIT)) @@ -172,18 +173,32 @@ miss(p, tail) (void)strcpy(tail, p->name); if (!(p->flags & F_VISIT)) (void)printf("missing: %s", path); - if (p->type != F_DIR) { + if (p->type != F_DIR && p->type != F_LINK) { putchar('\n'); continue; } create = 0; + if (p->type == F_LINK) + type = "symlink"; + else + type = "directory"; if (!(p->flags & F_VISIT) && uflag) { if (!(p->flags & (F_UID | F_UNAME))) - (void)printf(" (directory not created: user not specified)"); + (void)printf(" (%s not created: user not specified)", type); else if (!(p->flags & (F_GID | F_GNAME))) - (void)printf(" (directory not created: group not specified)"); - else if (!(p->flags & F_MODE)) + (void)printf(" (%s not created: group not specified)", type); + else if (p->type == F_LINK) { + if (symlink(p->slink, path)) + (void)printf(" (symlink not created: %s)\n", + strerror(errno)); + else + (void)printf(" (created)\n"); + if (lchown(path, p->st_uid, p->st_gid)) + (void)printf("%s: user/group not modified: %s\n", + path, strerror(errno)); + continue; + } else if (!(p->flags & F_MODE)) (void)printf(" (directory not created: mode not specified)"); else if (mkdir(path, S_IRWXU)) (void)printf(" (directory not created: %s)", |