]> git.wh0rd.org - dump.git/blobdiff - restore/utilities.c
Hashlist implementation for directory entries in restore.
[dump.git] / restore / utilities.c
index d0539383a306ab194ae13c51998100acc2c2d5b3..e96dcf319fd97d70251005edc8a1539bba79edaf 100644 (file)
@@ -37,7 +37,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: utilities.c,v 1.23 2003/10/26 16:05:48 stelian Exp $";
+       "$Id: utilities.c,v 1.25 2004/12/14 14:07:58 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -187,8 +187,13 @@ removenode(struct entry *ep)
 
        if (ep->e_type != NODE)
                badentry(ep, "removenode: not a node");
-       if (ep->e_entries != NULL)
-               badentry(ep, "removenode: non-empty directory");
+       if (ep->e_entries != NULL) {
+               int i;
+               for (i = 0; i < DIRHASH_SIZE; i++) {
+                       if (ep->e_entries[i] != NULL)
+                               badentry(ep, "removenode: non-empty directory");
+               }
+       }
        ep->e_flags |= REMOVED;
        ep->e_flags &= ~TMPNAME;
        cp = myname(ep);
@@ -371,8 +376,15 @@ badentry(struct entry *ep, const char *msg)
        fprintf(stderr, "parent name %s\n", myname(ep->e_parent));
        if (ep->e_sibling != NULL)
                fprintf(stderr, "sibling name: %s\n", myname(ep->e_sibling));
-       if (ep->e_entries != NULL)
-               fprintf(stderr, "next entry name: %s\n", myname(ep->e_entries));
+       if (ep->e_entries != NULL) {
+               int i;
+               for (i = 0; i < DIRHASH_SIZE; i++) {
+                       if (ep->e_entries[i] != NULL) {
+                               fprintf(stderr, "next entry name: %s\n", myname(ep->e_entries[0]));
+                               break;
+                       }
+               }
+       }
        if (ep->e_links != NULL)
                fprintf(stderr, "next link name: %s\n", myname(ep->e_links));
        if (ep->e_next != NULL)
@@ -506,7 +518,7 @@ void resizemaps(dump_ino_t oldmax, dump_ino_t newmax)
 void
 GetPathFile(char *source, char *path, char *fname)
 {
-       char    *p, *s;
+       char *p, *s;
 
        *path = 0;
        *fname = 0;
@@ -606,13 +618,13 @@ Inode2Tapepos(dump_ino_t ino, long *tnum, long long *tpos, int exactmatch)
 int
 GetSCSIIDFromPath(char *devPath, long *id)
 {
-       int                             len;
-       char                    fbuff[2048];
-       char                    path[2048];
-       char                    fname[2048];
-       char                    *fpn = fname;
-       char                    idstr[32];
-       char                    *ip = idstr;
+       int     len;
+       char    fbuff[2048];
+       char    path[2048];
+       char    fname[2048];
+       char    *fpn = fname;
+       char    idstr[32];
+       char    *ip = idstr;
 
        bzero(fbuff, sizeof(fbuff));
        if ((len = readlink(devPath, fbuff, 2048)) == -1) {
@@ -643,17 +655,14 @@ int
 CreateAppleDoubleFileRes(char *oFile, FndrFileInfo *finderinfo, mode_t mode, int flags,
                struct timeval *timep, u_int32_t uid, u_int32_t gid)
 {
-       int                             err = 0;
-       int                             fdout;
-       char                    *p;
-       char                    *f;
-       char                    *pp;
+       int             err = 0;
+       int             fdout;
+       char            *p;
+       char            *pp;
        ASDHeaderPtr    hp;
-       ASDEntryPtr             ep;
-       long                    thesize;
-       long                    n;
-       long                    loops;
-       long                    remain;
+       ASDEntryPtr     ep;
+       long            thesize;
+       long            n;
 
 
        n = 1;  /* number of entries in double file ._ only finderinfo */