appliance: Touch cached appliance files so they don't get tmp cleaned.
authorRichard W.M. Jones <rjones@redhat.com>
Sat, 11 Dec 2010 23:23:36 +0000 (23:23 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Sat, 11 Dec 2010 23:33:22 +0000 (23:33 +0000)
src/appliance.c

index 6d560ec..30eb6fd 100644 (file)
@@ -563,18 +563,23 @@ hard_link_to_cached_appliance (guestfs_h *g,
     perrorf (g, "link: %s %s", filename, *kernel);
     goto error;
   }
     perrorf (g, "link: %s %s", filename, *kernel);
     goto error;
   }
+  (void) lutimes (filename, NULL); /* lutimes because it's a symlink */
+
   snprintf (filename, len, "%s/initrd", cachedir);
   (void) unlink (*initrd);
   if (link (filename, *initrd) == -1) {
     perrorf (g, "link: %s %s", filename, *initrd);
     goto error;
   }
   snprintf (filename, len, "%s/initrd", cachedir);
   (void) unlink (*initrd);
   if (link (filename, *initrd) == -1) {
     perrorf (g, "link: %s %s", filename, *initrd);
     goto error;
   }
+  (void) utime (filename, NULL);
+
   snprintf (filename, len, "%s/root", cachedir);
   (void) unlink (*appliance);
   if (link (filename, *appliance) == -1) {
     perrorf (g, "link: %s %s", filename, *appliance);
     goto error;
   }
   snprintf (filename, len, "%s/root", cachedir);
   (void) unlink (*appliance);
   if (link (filename, *appliance) == -1) {
     perrorf (g, "link: %s %s", filename, *appliance);
     goto error;
   }
+  (void) utime (filename, NULL);
 
   return 0;
 
 
   return 0;