Date: Wed, 06 Oct 1999 22:54:48 +0100 From: Tony Finch <fanf@demon.net> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/14171: [PATCH] create symbolic links using mtree Message-ID: <E11Yz1M-000MdD-00@fanf.eng.demon.net>
next in thread | raw e-mail | index | archive | help
>Number: 14171 >Category: bin >Synopsis: [PATCH] create symbolic links using mtree >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Oct 6 15:00:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Tony Finch >Release: FreeBSD 3.3-STABLE-19990927 i386 >Organization: Demon Internet Ltd >Environment: >Description: It would be useful to be able to create hierarchies containing symbolic links using mtree, so I implemented this patch. >How-To-Repeat: >Fix: --- /usr/src/usr.sbin/mtree/verify.c Wed Sep 1 17:24:19 1999 +++ /usr/src/usr.sbin/mtree/verify.c Wed Oct 6 22:45:47 1999 @@ -160,6 +160,7 @@ { register int create; register char *tp; + const char *type; for (; p; p = p->next) { if (p->type != F_DIR && (dflag || p->flags & F_VISIT)) @@ -167,18 +168,32 @@ (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)", >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E11Yz1M-000MdD-00>