From 0d27c5f4cbb3fee83121ad9c0c12e25efcc8a0af Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 4 Apr 2007 17:55:13 +0000 Subject: [PATCH] avoid crash in case of a rather weird (==misconfigured?) sync state location. --- src/sync.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sync.c b/src/sync.c index 347dfef..b9bfdb3 100644 --- a/src/sync.c +++ b/src/sync.c @@ -711,10 +711,11 @@ sync_boxes( store_t *mctx, const char *mname, goto bail; } - s = strrchr( dname, '/' ); - *s = 0; - mkdir( dname, 0700 ); - *s = '/'; + if ((s = strrchr( dname, '/' ))) { + *s = 0; + mkdir( dname, 0700 ); + *s = '/'; + } if (lfd < 0) { if ((lfd = open( lname, O_WRONLY|O_CREAT, 0666 )) < 0) goto lferr;