]> Dogcows Code - chaz/tar/blobdiff - src/gnu.c
Initial revision
[chaz/tar] / src / gnu.c
index 09d993d63e0abf992e1e0343bc60b895f2ae2bb1..ca865d04a09744e655d82df812c786f03b622e89 100644 (file)
--- a/src/gnu.c
+++ b/src/gnu.c
@@ -266,7 +266,7 @@ collect_and_sort_names()
                n->found=0;
        }
        if(gnu_dumpfile)
-               write_dir_file();
+               write_dir_file(gnu_dumpfile);
 }
 
 int
@@ -470,36 +470,33 @@ int device;
 
        for(n=namelist;n;n=n->next) {
                if(!strcmp(n->name,p)) {
-                       n->dir_contents = new_buf ? new_buf : "\0\0\0\0";
+                       n->dir_contents = new_buf;
                        break;
                }
        }
 
-       if (new_buf)
-         {
-           len=strlen(p);
-           buflen= NAMSIZ<=len ? len + NAMSIZ : NAMSIZ;
-           namebuf= ck_malloc(buflen+1);
-
-           (void)strcpy(namebuf,p);
-           if(namebuf[len-1]!='/') {
-             namebuf[len++]='/';
-             namebuf[len]='\0';
-           }
-           for(p_buf=new_buf;*p_buf;p_buf+=sublen+1) {
-             sublen=strlen(p_buf);
-             if(*p_buf=='D') {
-               if(len+sublen>=buflen) {
-                 buflen+=NAMSIZ;
-                 namebuf= ck_realloc(namebuf,buflen+1);
+       len=strlen(p);
+       buflen= NAMSIZ<=len ? len + NAMSIZ : NAMSIZ;
+       namebuf= ck_malloc(buflen+1);
+
+       (void)strcpy(namebuf,p);
+       if(namebuf[len-1]!='/') {
+               namebuf[len++]='/';
+               namebuf[len]='\0';
+       }
+       for(p_buf=new_buf;*p_buf;p_buf+=sublen+1) {
+               sublen=strlen(p_buf);
+               if(*p_buf=='D') {
+                       if(len+sublen>=buflen) {
+                               buflen+=NAMSIZ;
+                               namebuf= ck_realloc(namebuf,buflen+1);
+                       }
+                       (void)strcpy(namebuf+len,p_buf+1);
+                       addname(namebuf);
+                       add_dir_name(namebuf,device);
                }
-               (void)strcpy(namebuf+len,p_buf+1);
-               addname(namebuf);
-               add_dir_name(namebuf,device);
-             }
-           }
-           free(namebuf);
-         }
+       }
+       free(namebuf);
 }
 
 /* Returns non-zero if p is . or ..   This could be a macro for speed. */
@@ -534,7 +531,7 @@ int skipcrud;
        char *from,*to;
        extern union record *head;
 
-       dirp=opendir(skipcrud+current_file_name);
+       dirp=opendir(skipcrud+head->header.name);
 
        if(!dirp) {
                        /* The directory doesn't exist now.  It'll be created.
@@ -583,7 +580,7 @@ int skipcrud;
                                break;
                }
                if(*arc=='\0') {
-                       p=new_name(skipcrud+current_file_name,cur);
+                       p=new_name(skipcrud+head->header.name,cur);
                        if(f_confirm && !confirm("delete",p)) {
                                free(p);
                                continue;
This page took 0.025322 seconds and 4 git commands to generate.