]> Dogcows Code - chaz/tar/blobdiff - src/create.c
*** empty log message ***
[chaz/tar] / src / create.c
index 3de1c96dee34ce2fef68c2abe8f88d86a5356217..b03c2f227c694df8990bf5cd7545f4eab3840bc7 100644 (file)
@@ -91,8 +91,6 @@ extern struct name *gnu_list_name;
 extern void print_header();
 
 union record *start_header();
-void add_mangle();
-void add_symlink_mangle();
 void blank_name_list();
 int check_exclude();
 PTR ck_malloc();
@@ -115,7 +113,6 @@ void to_oct();
 void dump_file();
 void write_dir_file();
 void write_eot();
-void write_mangled();
 int zero_record();
 
 /* This code moved from tar.h since create.c is the only file that cares
@@ -177,15 +174,11 @@ create_archive()
                free(buf);
        } else {
                p = name_next(1);
-               if(!p)
-                       dump_file(".", -1, 1);
-               else {
-                       do dump_file(p, -1, 1);
-                       while (p = name_next(1));
-               }
+               do 
+                 dump_file(p, -1, 1);
+               while (p = name_next(1));
        }
 
-       write_mangled();
        write_eot();
        close_archive();
        if(f_gnudump)
@@ -213,6 +206,7 @@ dump_file (p, curdev, toplevel)
        char save_linkflag;
        extern time_t new_time;
        int critical_error = 0;
+       time_t restore_times[2];
 /*     int sparse_ind = 0;*/
 
 
@@ -239,6 +233,9 @@ badfile:
                  errors++;
                return;
        }
+       
+       restore_times[0] = hstat.st_atime;
+       restore_times[1] = hstat.st_utime;
 
 #ifdef S_ISHIDDEN
        if (S_ISHIDDEN (hstat.st_mode)) {
@@ -577,6 +574,8 @@ badfile:
                    if (unlink (p) == -1)
                      msg_perror ("cannot remove %s", p);
                  }
+               if (f_atime_preserve)
+                 utime (p, restore_times);
                return;
 
                /*
@@ -595,7 +594,9 @@ badfile:
                        save_name=0;
                if(f>=0)
                        (void)close(f);
-             return;
+               if (f_atime_preserve)
+                 utime (p, restore_times);
+               return;
        }
 
 #ifdef S_ISLNK
@@ -727,6 +728,8 @@ badfile:
                        }
                        if(f_multivol)
                                save_name = 0;
+                       if (f_atime_preserve)
+                         utime (p, restore_times);
                        return;
                }
 
@@ -739,7 +742,7 @@ badfile:
                 * See if we are crossing from one file system to another,
                 * and avoid doing so if the user only wants to dump one file system.
                 */
-               if (f_local_filesys && toplevel && curdev != hstat.st_dev) {
+               if (f_local_filesys && !toplevel && curdev != hstat.st_dev) {
                        if(f_verbose)
                                msg("%s: is on a different filesystem; not dumped",p);
                        return;
@@ -784,6 +787,8 @@ badfile:
 
                closedir(dirp);
                free(namebuf);
+               if (f_atime_preserve)
+                 utime (p, restore_times);
                return;
        }
 
@@ -1219,8 +1224,6 @@ start_header(name, st)
        if (f_standard) {
                header->header.linkflag = LF_NORMAL;    /* New default */
                strcpy(header->header.magic, TMAGIC);   /* Mark as Unix Std */
-               /* Fill in the POSIX TVERSION field after magic.  */
-               header->header.magic[6] = header->header.magic[7] = '0';
                finduname(header->header.uname, st->st_uid);
                findgname(header->header.gname, st->st_gid);
        }
This page took 0.022365 seconds and 4 git commands to generate.