summaryrefslogtreecommitdiffstats
path: root/sbin/restore/utilities.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-11 12:55:19 +0000
committerpeter <peter@FreeBSD.org>1997-03-11 12:55:19 +0000
commit494e7b3a77c6b07213586c03d8ee844304aafe20 (patch)
tree4dfb78949ad3c93600795746b894fcbb170c485f /sbin/restore/utilities.c
parenta4f4635e03e0fdc84d465c0517f302f55961b645 (diff)
downloadFreeBSD-src-494e7b3a77c6b07213586c03d8ee844304aafe20.zip
FreeBSD-src-494e7b3a77c6b07213586c03d8ee844304aafe20.tar.gz
Merge from Lite2
- cleanups, - whiteout support - bug fixes (chflags missing on a few file types etc) The dump/restore folks would want to have a closer look at this, the change is pretty big.
Diffstat (limited to 'sbin/restore/utilities.c')
-rw-r--r--sbin/restore/utilities.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/sbin/restore/utilities.c b/sbin/restore/utilities.c
index b2e442e..6008f7a 100644
--- a/sbin/restore/utilities.c
+++ b/sbin/restore/utilities.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)utilities.c 8.2 (Berkeley) 3/25/94";
+static char sccsid[] = "@(#)utilities.c 8.5 (Berkeley) 4/28/95";
#endif /* not lint */
#include <sys/param.h>
@@ -61,7 +61,7 @@ pathcheck(name)
struct entry *ep;
char *start;
- start = index(name, '/');
+ start = strchr(name, '/');
if (start == 0)
return;
for (cp = start; *cp != '\0'; cp++) {
@@ -230,6 +230,45 @@ linkit(existing, new, type)
}
/*
+ * Create a whiteout.
+ */
+int
+addwhiteout(name)
+ char *name;
+{
+
+ if (!Nflag && mknod(name, S_IFWHT, 0) < 0) {
+ fprintf(stderr, "warning: cannot create whiteout %s: %s\n",
+ name, strerror(errno));
+ return (FAIL);
+ }
+ vprintf(stdout, "Create whiteout %s\n", name);
+ return (GOOD);
+}
+
+/*
+ * Delete a whiteout.
+ */
+void
+delwhiteout(ep)
+ register struct entry *ep;
+{
+ char *name;
+
+ if (ep->e_type != LEAF)
+ badentry(ep, "delwhiteout: not a leaf");
+ ep->e_flags |= REMOVED;
+ ep->e_flags &= ~TMPNAME;
+ name = myname(ep);
+ if (!Nflag && undelete(name) < 0) {
+ fprintf(stderr, "warning: cannot delete whiteout %s: %s\n",
+ name, strerror(errno));
+ return;
+ }
+ vprintf(stdout, "Delete whiteout %s\n", name);
+}
+
+/*
* find lowest number file (above "start") that needs to be extracted
*/
ino_t
OpenPOWER on IntegriCloud