]> Dogcows Code - chaz/tar/blobdiff - src/incremen.c
Merge recent gnulib changes, and remove some lint.
[chaz/tar] / src / incremen.c
index 47763ff1accec99a1b306b7ac62e94cd85cad32a..6009a2def1696c14cd6ec97d572af96dd626fd58 100644 (file)
@@ -1,7 +1,7 @@
 /* GNU dump extensions to tar.
 
    Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
-   2003 Free Software Foundation, Inc.
+   2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -145,7 +145,7 @@ scan_path (struct obstack *stk, char *path, dev_t device)
 
   directory = find_directory (path);
   children = directory ? directory->children : CHANGED_CHILDREN;
-  
+
   if (dirp && children != NO_CHILDREN)
     for (entry = dirp;
         (entrylen = strlen (entry)) != 0;
@@ -159,24 +159,24 @@ scan_path (struct obstack *stk, char *path, dev_t device)
            name_buffer = xrealloc (name_buffer, name_buffer_size + 2);
          }
        strcpy (name_buffer + name_length, entry);
-       
+
        if (excluded_name (name_buffer))
          obstack_1grow (stk, 'N');
        else
          {
            struct stat stat_data;
-           
+
            if (deref_stat (dereference_option, name_buffer, &stat_data))
              {
                stat_diag (name_buffer);
                continue;
              }
-           
+
            if (S_ISDIR (stat_data.st_mode))
              {
                bool nfs = NFS_FILE_STAT (stat_data);
-               
-               if (directory = find_directory (name_buffer), directory)
+
+               if ((directory = find_directory (name_buffer)) != NULL)
                  {
                    /* With NFS, the same file can have two different devices
                       if an NFS directory is mounted in multiple locations,
@@ -184,7 +184,7 @@ scan_path (struct obstack *stk, char *path, dev_t device)
                       To avoid spurious incremental redumping of
                       directories, consider all NFS devices as equal,
                       relying on the i-node to establish differences.  */
-                   
+
                    if (! (((directory->nfs & nfs)
                            || directory->device_number == stat_data.st_dev)
                           && directory->inode_number == stat_data.st_ino))
@@ -209,13 +209,13 @@ scan_path (struct obstack *stk, char *path, dev_t device)
                                                stat_data.st_ino, nfs, 1);
                    directory->children =
                      ((listed_incremental_option
-                       || newer_mtime_option <= stat_data.st_mtime
-                       || (after_date_option &&
-                           newer_ctime_option <= stat_data.st_ctime))
+                       || OLDER_STAT_TIME (stat_data, m)
+                       || (after_date_option
+                           && OLDER_STAT_TIME (stat_data, c)))
                       ? ALL_CHILDREN
                       : CHANGED_CHILDREN);
                  }
-               
+
                if (one_file_system_option && device != stat_data.st_dev)
                  directory->children = NO_CHILDREN;
                else if (children == ALL_CHILDREN)
@@ -239,25 +239,24 @@ scan_path (struct obstack *stk, char *path, dev_t device)
 
            else
              if (children == CHANGED_CHILDREN
-                 && stat_data.st_mtime < newer_mtime_option
-                 && (!after_date_option
-                     || stat_data.st_ctime < newer_ctime_option))
+                 && OLDER_STAT_TIME (stat_data, m)
+                 && (!after_date_option || OLDER_STAT_TIME (stat_data, c)))
                obstack_1grow (stk, 'N');
              else
                obstack_1grow (stk, 'Y');
          }
-       
+
        obstack_grow (stk, entry, entrylen + 1);
       }
 
   obstack_grow (stk, "\000\000", 2);
-  
+
   free (name_buffer);
   if (dirp)
     free (dirp);
 }
 
-/* Sort the contents of the obstack, anr convert it to the char * */
+/* Sort the contents of the obstack, and convert it to the char * */
 static char *
 sort_obstack (struct obstack *stk)
 {
@@ -267,16 +266,16 @@ sort_obstack (struct obstack *stk)
   char *buffer;
   char **array;
   char **array_cursor;
-  
+
   counter = 0;
   for (cursor = pointer; *cursor; cursor += strlen (cursor) + 1)
     counter++;
-  
+
   if (!counter)
     return NULL;
 
   array = obstack_alloc (stk, sizeof (char *) * (counter + 1));
-  
+
   array_cursor = array;
   for (cursor = pointer; *cursor; cursor += strlen (cursor) + 1)
     *array_cursor++ = cursor;
@@ -290,7 +289,7 @@ sort_obstack (struct obstack *stk)
   for (array_cursor = array; *array_cursor; array_cursor++)
     {
       char *string = *array_cursor;
-      
+
       while ((*cursor++ = *string++))
        continue;
     }
@@ -357,7 +356,10 @@ read_directory_file (void)
        ERROR ((0, 0, "%s:1: %s", quotearg_colon (listed_incremental_option),
                _("Time stamp out of range")));
       else
-       newer_mtime_option = t;
+       {
+         newer_mtime_option.tv_sec = t;
+         newer_mtime_option.tv_nsec = 0;
+       }
 
       while (0 < (n = getline (&buf, &bufsize, fp)))
        {
@@ -453,9 +455,13 @@ write_directory_file (void)
   if (fclose (fp) != 0)
     close_error (listed_incremental_option);
 }
+
 \f
 /* Restoration of incremental dumps.  */
 
+/* Examine the directories under directory_name and delete any
+   files that were not there at the time of the back-up.
+   FIXME: The function name is obviously a misnomer */
 void
 gnu_restore (char const *directory_name)
 {
This page took 0.027592 seconds and 4 git commands to generate.