On Mon, Jul 13, 2009 at 02:10:12PM +0200, Oswald Buddenhagen wrote:
> On Mon, Jul 13, 2009 at 01:35:09PM +0200, Antoine Reilles wrote:
> > > > The attached patch does fix this segfault, and dit let isync work again
> > > > for me.
> > > > 
> 
> > -   bl = nfsnprintf( base, sizeof(base), "%ld.%d_%d.%s", time( 0 ), Pid, 
> > ++MaildirCount, Hostname );
> > +   bl = nfsnprintf( base, sizeof(base), "%lld.%d_%d.%s", (long long int) 
> > time( 0 ), Pid, ++MaildirCount, Hostname );
> >
> hmpf. choosing an upcast is "wasteful" and fairly useless for the next
> almost 30 years. on a more serious note, %lld is not necessarily
> portable (C99 syntax, i think). i think the simple route of downcasting
> to long is good enough for now. if you like overkill, you could adjust
> the format string depending on the system (i do such magic for file
> offsets in puf.sf.net).

Ok, so maybe this one is better.

antoine

$NetBSD: patch-af,v 1.4 2009/07/12 20:26:59 tonio Exp $

time_t may be 64bits

--- ./src/drv_maildir.c.orig    2008-02-23 10:02:21.000000000 +0100
+++ ./src/drv_maildir.c
@@ -936,7 +936,7 @@ maildir_store_msg( store_t *gctx, msg_da
        int ret, fd, bl;
        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 int) time( 0 
), Pid, ++MaildirCount, Hostname );
        if (uid) {
 #ifdef USE_DB
                if (ctx->db) {
@@ -1087,7 +1087,7 @@ maildir_trash_msg( store_t *gctx, messag
                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/%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 int) time( 
0 ), Pid, ++MaildirCount, Hostname, s ? s : "" );
                if (!rename( buf, nbuf ))
                        break;
                if (!stat( buf, &st )) {

Attachment: pgp6EFdn4Q5Bh.pgp
Description: PGP signature

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to