[Dovecot] expire-tool --test: timestamps

e-frog e-frog at gmx.de
Sat Jun 6 16:35:44 EEST 2009


$ /usr/sbin/dovecot --exec-mail ext expire-tool --test
Info: Trash: timestamp 1243963680 (Tue Jun  2 19:28:00 2009
) -> 1244307774 (Tue Jun  2 19:28:00 2009
)

Both human readable timestamps are equal as ctime() returns a pointer
to a static buffer. In addition there are some newline characters added
by ctime(). The following patch is a try to fix this for 1.2.rc5.


--- expire-tool.c.orig  2009-06-06 13:29:31.000000000 +0200
+++ expire-tool.c       2009-06-06 15:17:07.000000000 +0200
@@ -351,9 +351,13 @@ static void expire_run(bool testrun)
                        } else if (!testrun)
                                dict_set(trans, key, new_value);
                        else {
-                               i_info("%s: timestamp %s (%s) -> %s (%s)",
-                                      userp, value, ctime(&expire_time),
-                                      new_value, ctime(&oldest));
+                               char *expire_ctime = i_strdup(ctime(&expire_time));
+                               char *oldest_ctime = i_strdup(ctime(&oldest));
+                               i_info("%s: timestamp %s (%.24s) -> %s (%.24s)",
+                                      userp, value, expire_ctime,
+                                      new_value, oldest_ctime);
+                               i_free(expire_ctime);
+                               i_free(oldest_ctime);
                        }
                }
        }



More information about the dovecot mailing list