From: Stelian Pop Date: Fri, 11 Jun 2010 09:51:59 +0000 (+0000) Subject: Extract backuped sockets as dummy files. X-Git-Tag: release_0_4b43~3 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ec5c1bc937c43be6649a203619bae2d3d9b0d3c2;p=dump.git Extract backuped sockets as dummy files. --- diff --git a/CHANGES b/CHANGES index bcbb3b5..f2d56fc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.313 2010/06/10 12:17:35 stelian Exp $ +$Id: CHANGES,v 1.314 2010/06/11 09:51:59 stelian Exp $ Changes between versions 0.4b42 and 0.4b43 (released ?????????????) =================================================================== @@ -54,6 +54,12 @@ Changes between versions 0.4b42 and 0.4b43 (released ?????????????) Kieran Clancy for reporting the bug (Sourceforge bug #2999207). +12. Extract dumped UNIX sockets as dummy files, instead of not + restoring them at all. This will correct some warnings during + the restoration of incrementals, if the inodes previously occupied + by sockets gets reused by other files. See Sourceforge bug + #3007216 for details. + Changes between versions 0.4b41 and 0.4b42 (released June 18, 2009) =================================================================== diff --git a/restore/tape.c b/restore/tape.c index 3dc8bba..5ee9973 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.96 2010/03/22 15:40:55 stelian Exp $"; + "$Id: tape.c,v 1.97 2010/06/11 09:51:59 stelian Exp $"; #endif /* not lint */ #include @@ -843,9 +843,43 @@ extractfile(struct entry *ep, int doremove) 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: {