Browse Source

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 <tonio@NetBSD.org>.

(cherry picked from commit 89add4f330)

Conflicts:
    src/drv_maildir.c
1.0
Oswald Buddenhagen 12 years ago
parent
commit
a772806aea
  1. 4
      src/drv_maildir.c

4
src/drv_maildir.c

@ -936,7 +936,7 @@ maildir_store_msg( store_t *gctx, msg_data_t *data, int *uid )
int ret, fd, bl; int ret, fd, bl;
char buf[_POSIX_PATH_MAX], nbuf[_POSIX_PATH_MAX], fbuf[NUM_FLAGS + 3], base[128]; 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 (uid) { if (uid) {
#ifdef USE_DB #ifdef USE_DB
if (ctx->db) { if (ctx->db) {
@ -1087,7 +1087,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 ); nfsnprintf( buf, sizeof(buf), "%s/%s/%s", gctx->path, subdirs[gmsg->status & M_RECENT], msg->base );
s = strstr( msg->base, ":2," ); s = strstr( msg->base, ":2," );
nfsnprintf( nbuf, sizeof(nbuf), "%s%s/%s/%ld.%d_%d.%s%s", gctx->conf->path, gctx->conf->trash, nfsnprintf( nbuf, sizeof(nbuf), "%s%s/%s/%ld.%d_%d.%s%s", gctx->conf->path, gctx->conf->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 )) if (!rename( buf, nbuf ))
break; break;
if (!stat( buf, &st )) { if (!stat( buf, &st )) {

Loading…
Cancel
Save