Revision: 14256
Author: adrian.chadd
Date: Sat Aug  1 22:57:41 2009
Log: Handle zero-sized files correctly - this may be the output of truncate
instead of unlink.



http://code.google.com/p/lusca-cache/source/detail?r=14256

Modified:
  /branches/LUSCA_HEAD/app/ufs_rebuild/ufs_build_dir.c

=======================================
--- /branches/LUSCA_HEAD/app/ufs_rebuild/ufs_build_dir.c        Sat Aug  1  
22:56:29 2009
+++ /branches/LUSCA_HEAD/app/ufs_rebuild/ufs_build_dir.c        Sat Aug  1  
22:57:41 2009
@@ -75,6 +75,12 @@
                perror("fstat");
                return 0;
        }
+
+       /* If the file is zero length - may have been truncated instead of  
deleted */
+       if (sb.st_size == 0) {
+               close(fd);
+               return 0;
+       }

        len = read(fd, buf, BUFSIZE);
        debug(47, 3) ("read_file: FILE: %s\n", path);

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to