#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.94 2009/12/03 12:46:30 stelian Exp $";
+ "$Id: tape.c,v 1.97 2010/06/11 09:51:59 stelian Exp $";
#endif /* not lint */
#include <config.h>
return (FAIL);
case IFSOCK:
- Vprintf(stdout, "skipped socket %s\n", name);
+ {
+ uid_t luid = curfile.dip->di_uid;
+ gid_t lgid = curfile.dip->di_gid;
+
+ Vprintf(stdout, "extract socket as dummy file %s\n", name);
skipfile();
+ if (Nflag)
+ return (GOOD);
+ if (! (spcl.c_flags & DR_METAONLY)) {
+ int fd;
+ if (uflag)
+ (void)unlink(name);
+ if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) {
+ warn("%s: cannot create dummy file", name);
+ return (FAIL);
+ }
+ close(fd);
+ }
+ (void) chown(name, luid, lgid);
+ (void) chmod(name, mode);
+ extractattr(name);
+ utimes(name, timep);
+ if (flags)
+#ifdef __linux__
+ (void) lsetflags(name, flags);
+#else
+#ifdef sunos
+ {
+ warn("%s: cannot call chflags", name);
+ /* (void) chflags(name, flags); */
+ }
+#else
+ (void) chflags(name, flags);
+#endif
+#endif
return (GOOD);
+ }
case IFDIR:
{
}
case IFIFO:
+ {
+ uid_t luid = curfile.dip->di_uid;
+ gid_t lgid = curfile.dip->di_gid;
+
Vprintf(stdout, "extract fifo %s\n", name);
skipfile();
if (Nflag)
return (FAIL);
}
}
- (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid);
+ (void) chown(name, luid, lgid);
(void) chmod(name, mode);
extractattr(name);
utimes(name, timep);
#endif
#endif
return (GOOD);
-
+ }
case IFCHR:
case IFBLK:
+ {
+ uid_t luid = curfile.dip->di_uid;
+ gid_t lgid = curfile.dip->di_gid;
+ int lrdev = (int)curfile.dip->di_rdev;
+
Vprintf(stdout, "extract special file %s\n", name);
skipfile();
if (Nflag)
if (! (spcl.c_flags & DR_METAONLY)) {
if (uflag)
(void)unlink(name);
- if (mknod(name, mode, (int)curfile.dip->di_rdev) < 0) {
+ if (mknod(name, mode, lrdev) < 0) {
warn("%s: cannot create special file", name);
return (FAIL);
}
}
- (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid);
+ (void) chown(name, luid, lgid);
(void) chmod(name, mode);
extractattr(name);
utimes(name, timep);
#endif
#endif
return (GOOD);
-
+ }
case IFREG:
{
uid_t luid = curfile.dip->di_uid;
skipfile();
return (FAIL);
}
-
+
memset(xattrbuf, 0, XATTR_MAXSIZE);
xattrlen = 0;
+ /*
+ * ugly hack: cope with invalid spcl.c_addr[] records written by
+ * old versions of dump.
+ */
+ readmapflag = 1;
+
getfile(xtrxattr, xtrnull);
+ readmapflag = 0;
+
memcpy(buffer, xattrbuf, XATTR_MAXSIZE);
return (GOOD);