[dovecot-cvs]
dovecot/src/lib-index/maildir maildir-index.c,1.35,1.36
cras at procontrol.fi
cras at procontrol.fi
Sun Aug 24 04:50:24 EEST 2003
- Previous message: [dovecot-cvs]
dovecot/src/pop3-login client-authenticate.c,1.10,1.11
client.c,1.14,1.15 client.h,1.5,1.6
- Next message: [dovecot-cvs]
dovecot/doc dovecot-ldap.conf,1.6,1.7 dovecot-pgsql.conf,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-index/maildir
In directory danu:/tmp/cvs-serv22622/lib-index/maildir
Modified Files:
maildir-index.c
Log Message:
Don't use microseconds in maildir name if it's not needed.
Index: maildir-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/maildir/maildir-index.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- maildir-index.c 10 Aug 2003 23:56:23 -0000 1.35
+++ maildir-index.c 24 Aug 2003 00:50:22 -0000 1.36
@@ -112,10 +112,23 @@
const char *maildir_generate_tmp_filename(const struct timeval *tv)
{
static unsigned int create_count = 0;
+ static time_t first_stamp = 0;
- return t_strdup_printf("%s.P%sQ%uM%s.%s",
- dec2str(tv->tv_sec), my_pid, create_count++,
- dec2str(tv->tv_usec), my_hostname);
+ if (first_stamp == 0 || first_stamp == ioloop_time) {
+ /* it's possible that within last second another process had
+ the same UID as us. Use usecs to make sure we don't create
+ duplicate base name. */
+ first_stamp = ioloop_time;
+ return t_strdup_printf("%s.P%sQ%uM%s.%s",
+ dec2str(tv->tv_sec), my_pid,
+ create_count++,
+ dec2str(tv->tv_usec), my_hostname);
+ } else {
+ /* Don't bother with usecs. Saves a bit space :) */
+ return t_strdup_printf("%s.P%sQ%u.%s",
+ dec2str(tv->tv_sec), my_pid,
+ create_count++, my_hostname);
+ }
}
int maildir_create_tmp(struct mail_index *index, const char *dir,
- Previous message: [dovecot-cvs]
dovecot/src/pop3-login client-authenticate.c,1.10,1.11
client.c,1.14,1.15 client.h,1.5,1.6
- Next message: [dovecot-cvs]
dovecot/doc dovecot-ldap.conf,1.6,1.7 dovecot-pgsql.conf,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list