From 89add4f330fbb525988dcddc9ccfd3ad30296370 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 23 Mar 2013 15:07:47 +0100 Subject: [PATCH] downcast time_t to long for printing time_t may be long long. to keep the sprintf format strings simple, just downcast - this is not going to be a problem for the next 30 years, and until then long will be 64-bit everywhere anyway. suggested 3.5 years ago by Antoine Reilles . --- src/drv_maildir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drv_maildir.c b/src/drv_maildir.c index 4807e75..629da10 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -1155,7 +1155,7 @@ maildir_store_msg( store_t *gctx, msg_data_t *data, int to_trash, int ret, fd, bl, uid; char buf[_POSIX_PATH_MAX], nbuf[_POSIX_PATH_MAX], fbuf[NUM_FLAGS + 3], base[128]; - bl = nfsnprintf( base, sizeof(base), "%ld.%d_%d.%s", time( 0 ), Pid, ++MaildirCount, Hostname ); + bl = nfsnprintf( base, sizeof(base), "%ld.%d_%d.%s", (long)time( 0 ), Pid, ++MaildirCount, Hostname ); if (!to_trash) { #ifdef USE_DB if (ctx->db) { @@ -1325,7 +1325,7 @@ maildir_trash_msg( store_t *gctx, message_t *gmsg, nfsnprintf( buf, sizeof(buf), "%s/%s/%s", gctx->path, subdirs[gmsg->status & M_RECENT], msg->base ); s = strstr( msg->base, ":2," ); nfsnprintf( nbuf, sizeof(nbuf), "%s/%s/%ld.%d_%d.%s%s", ctx->trash, - subdirs[gmsg->status & M_RECENT], time( 0 ), Pid, ++MaildirCount, Hostname, s ? s : "" ); + subdirs[gmsg->status & M_RECENT], (long)time( 0 ), Pid, ++MaildirCount, Hostname, s ? s : "" ); if (!rename( buf, nbuf )) break; if (!stat( buf, &st )) {