package: tmpreaper
tags: patch

Hi,

It would be nice if tmpreaper would be a bit more verbose on why a
particular file is not removed (at least, when --verbose=2 is
specified).  The attached patch fixes this.

Best regards,
Bas.



--- tmpreaper.c.orig    2008-10-06 14:20:25.000000000 +0200
+++ tmpreaper.c 2013-10-30 13:09:49.000000000 +0100
@@ -508,20 +508,32 @@
                /* check for mtime on directory instead of atime if requested */
                if ( FLAGS_MTIME_P(flags) ||
                    (FLAGS_MTIME_DIR_P(flags) && S_ISDIR(sb.st_mode))) {
-                   if (sb.st_mtime >= killTime)
+                   if (sb.st_mtime >= killTime) {
+                       message (LOG_DEBUG,
+                                "Entry (dir) mtime too recent (%li>=%li). 
`%s/%s'.\n",
+                                sb.st_mtime, killTime, dirname, ent->d_name);
                        continue;
+                   }
                }
                else {
-                   if (sb.st_atime >= killTime)
+                   if (sb.st_atime >= killTime) {
+                       message (LOG_DEBUG,
+                                "Entry atime too recent (%li>=%li). 
`%s/%s'.\n",
+                                sb.st_ctime, killTime, dirname, ent->d_name);
                        continue;
+                   }
                     /* If ctime option is given, the ctime must also be so    
*/
                     /* long ago. This is e.g. for samba as DOS preserves      
*/
                     /* mtime when copying, so such files get removed too soon 
*/
                     /* Don't do it for directories though, as ctime may get   
*/
                     /* reset below through utime()                            
*/
                     if (!S_ISDIR(sb.st_mode) &&
-                        FLAGS_CTIME_P(flags) && sb.st_ctime >= killTime)
+                        FLAGS_CTIME_P(flags) && sb.st_ctime >= killTime) {
+                           message (LOG_DEBUG,
+                                    "Entry ctime too recent (%li>=%li). 
`%s/%s'.\n",
+                                    sb.st_ctime, killTime, dirname, 
ent->d_name);
                             continue;
+                   }
                }
 
                if (S_ISDIR (sb.st_mode)) {

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to