alpine/alpine-maildir-closedir.patch

40 lines
1.2 KiB
Diff
Raw Normal View History

--- imap/src/osdep/unix/maildir.c 2011-10-17 10:11:55.000000000 +0200
+++ imap/src/osdep/unix/maildir.c 2011-10-17 10:39:31.000000000 +0200
@@ -2396,7 +2396,6 @@
|| !strncmp(d->d_name, MDUIDTEMP, strlen(MDUIDTEMP)))
break;
}
- closedir(dir);
rv = d ? !strncmp(d->d_name, tmp, strlen(tmp)) : 1;
createtemp = d ? 0 : 1;
if (d && rv == 0){ /* is there a temp file that is not ours? */
@@ -2410,6 +2409,7 @@
unlink(tmp);
}
}
+ closedir(dir);
if(createtemp){
FILE *fp;
sprintf(tmp,"%s/%s.%d.%lu", LOCAL->dir, MDUIDTEMP, getpid(), time(0));
@@ -2442,7 +2442,6 @@
if(!strncmp(d->d_name, MDUIDLAST, strlen(MDUIDLAST)))
break;
}
- closedir(dir);
createuid = d == NULL ? 1 : 0;
if(uid_last == NULL)
deleteuid++;
@@ -2473,9 +2472,10 @@
}
}
if(deleteuid){
- sprintf(tmp,"%s/%s", LOCAL->dir, d->d_name);
+ snprintf(tmp, sizeof(tmp), "%s/%s", LOCAL->dir, d->d_name);
unlink(tmp);
}
+ closedir(dir);
if(createuid)
maildir_write_uid(stream, (uid_last ? *uid_last : stream->uid_last),
uid_validity ? *uid_validity : time(0));
Nur in alpine-2.00/imap/src/osdep/unix: maildir.c~.