]> git.wh0rd.org - dump.git/commitdiff
Check for 'file system full' when creating temporary files.
authorStelian Pop <stelian@popies.net>
Tue, 5 Dec 2000 15:43:48 +0000 (15:43 +0000)
committerStelian Pop <stelian@popies.net>
Tue, 5 Dec 2000 15:43:48 +0000 (15:43 +0000)
CHANGES
THANKS
restore/dirs.c

diff --git a/CHANGES b/CHANGES
index 3a4df8802647ad1719075b31e66a97d937317f47..f71417fca3b6cc1c7957a28a1a960e1445c830ef 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.94 2000/12/04 16:05:35 stelian Exp $
+$Id: CHANGES,v 1.95 2000/12/05 15:43:48 stelian Exp $
 
 Changes between versions 0.4b20 and 0.4b21 (released ?????????????????)
 =======================================================================
@@ -15,6 +15,13 @@ Changes between versions 0.4b20 and 0.4b21 (released ?????????????????)
        _PATH_MNTTAB being undefined. Thanks to John Adams
        <johna@onevista.com> for reporting the bug.
 
+4.     Improved the error detection in restore when creating
+       the temporary files in TMPDIR. Now restore will corectly
+       report a 'no space left on device' error instead of 
+       strange errors which could imply an archive corruption.
+       Thanks to Gabriel Somlo <somlo@cs.colostate.edu> and
+       bgjenero <bgjenero@sympatico.ca> for reporting the bug.
+
 Changes between versions 0.4b19 and 0.4b20 (released November 10, 2000)
 =======================================================================
 
diff --git a/THANKS b/THANKS
index 8142560df2aaccaf3e1d3941913727d329cc65f6..4992ea1657992aeee55263017d74466a28728dc4 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.40 2000/12/04 16:05:35 stelian Exp $
+$Id: THANKS,v 1.41 2000/12/05 15:43:48 stelian Exp $
 
 Dump and restore were written by the people of the CSRG at the University
 of California, Berkeley.
@@ -63,6 +63,7 @@ Patrik Schindler      poc@pocnet.net
 Gunther Schlegel       schlegel@riege.de
 Chris Siebenmann       cks@utcc.utoronto.ca
 Bob Snyder             rsnyder@janet.advsys.com
+Gabriel Somlo          somlo@cs.colostate.edu
 Matti Taskinen         mkt@rni.helsinki.fi
 Jason L Tibbitts III   tibbs@math.uh.edu
 Mike Tibor             tibor@lib.uaa.alaska.edu
index 524128406100a486274603a54bb606cbdf785f3e..3d91c3cc15ffb311a1766a580e4e66d41979d71b 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: dirs.c,v 1.11 2000/12/04 15:43:17 stelian Exp $";
+       "$Id: dirs.c,v 1.12 2000/12/05 15:43:49 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -208,12 +208,13 @@ extractdirs(int genmode)
                curfile.action = USING;
                ip = curfile.dip;
                if (ip == NULL || (ip->di_mode & IFMT) != IFDIR) {
-                       (void) fclose(df);
+                       if ( fclose(df) == EOF )
+                               err(1, "cannot write to file %s", dirfile);
                        dirp = opendirfile(dirfile);
                        if (dirp == NULL)
                                warn("opendirfile");
-                       if (mf != NULL)
-                               (void) fclose(mf);
+                       if (mf != NULL && fclose(mf) == EOF )
+                               err(1, "cannot write to file %s", dirfile);
                        i = dirlookup(dot);
                        if (i == 0)
                                panic("Root directory is not on tape\n");
@@ -439,7 +440,8 @@ putent(struct direct *dp)
        if (dirloc + dp->d_reclen > DIRBLKSIZ) {
                ((struct direct *)(dirbuf + prev))->d_reclen =
                    DIRBLKSIZ - prev;
-               (void) fwrite(dirbuf, 1, DIRBLKSIZ, df);
+               if ( fwrite(dirbuf, 1, DIRBLKSIZ, df) != DIRBLKSIZ )
+                       err(1,"cannot write to file %s", dirfile);
                dirloc = 0;
        }
        memmove(dirbuf + dirloc, dp, (size_t)dp->d_reclen);
@@ -454,8 +456,11 @@ static void
 flushent(void)
 {
        ((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev;
-       (void) fwrite(dirbuf, (int)dirloc, 1, df);
+       if ( fwrite(dirbuf, (int)dirloc, 1, df) != 1 )
+               err(1, "cannot write to file %s", dirfile);
        seekpt = ftell(df);
+       if (seekpt == -1)
+               err(1, "cannot write to file %s", dirfile);
        dirloc = 0;
 }
 
@@ -748,7 +753,8 @@ allocinotab(ino_t ino, struct dinode *dip, long seekpt)
        node.flags = dip->di_flags;
        node.uid = dip->di_uid;
        node.gid = dip->di_gid;
-       (void) fwrite((char *)&node, 1, sizeof(struct modeinfo), mf);
+       if ( fwrite((char *)&node, 1, sizeof(struct modeinfo), mf) != sizeof(struct modeinfo) )
+               err(1,"cannot write to file %s", modefile);
        return (itp);
 }