diff options
author | jkh <jkh@FreeBSD.org> | 1998-05-09 05:23:02 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1998-05-09 05:23:02 +0000 |
commit | dcef58e481f6117f1a23a399e64de7f78db3e227 (patch) | |
tree | 3159d92312f9ac1cf1e86c128b9eb593b5fe4418 /sbin/restore/utilities.c | |
parent | 9c0f3d45b1a8df168ca3c201cafeb4775fc523be (diff) | |
download | FreeBSD-src-dcef58e481f6117f1a23a399e64de7f78db3e227.zip FreeBSD-src-dcef58e481f6117f1a23a399e64de7f78db3e227.tar.gz |
Well, nobody objected, so here's my -u (unlink) flag to restore.
Diffstat (limited to 'sbin/restore/utilities.c')
-rw-r--r-- | sbin/restore/utilities.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/restore/utilities.c b/sbin/restore/utilities.c index 6008f7a..5eec4de 100644 --- a/sbin/restore/utilities.c +++ b/sbin/restore/utilities.c @@ -145,7 +145,7 @@ newnode(np) if (np->e_type != NODE) badentry(np, "newnode: not a node"); cp = myname(np); - if (!Nflag && mkdir(cp, 0777) < 0) { + if (!Nflag && mkdir(cp, 0777) < 0 && !uflag) { np->e_flags |= EXISTED; fprintf(stderr, "warning: %s: %s\n", cp, strerror(errno)); return; @@ -206,6 +206,10 @@ linkit(existing, new, type) int type; { + /* if we want to unlink first, do it now so *link() won't fail */ + if (uflag && !Nflag) + (void)unlink(new); + if (type == SYMLINK) { if (!Nflag && symlink(existing, new) < 0) { fprintf(stderr, |