Mercurial > dovecot > core-2.2
changeset 274:ce5b402f6a7a HEAD
rename() file first, only then update index if it was successful.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 19 Sep 2002 22:01:12 +0300 |
parents | 9be2c12d0983 |
children | 910afdb348ae |
files | src/lib-index/maildir/maildir-index.c |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/maildir/maildir-index.c Thu Sep 19 21:58:09 2002 +0300 +++ b/src/lib-index/maildir/maildir-index.c Thu Sep 19 22:01:12 2002 +0300 @@ -161,9 +161,6 @@ const char *old_fname, *new_fname; const char *old_path, *new_path; - if (!mail_index_update_flags(index, rec, seq, flags, external_change)) - return FALSE; - /* we need to update the flags in the file name */ old_fname = index->lookup_field(index, rec, FIELD_TYPE_LOCATION); if (old_fname == NULL) { @@ -179,7 +176,7 @@ new_path = t_strconcat(index->dir, "/cur/", new_fname, NULL); /* minor problem: new_path is overwritten if it exists.. */ - if (rename(old_path, new_path) == -1) { + if (rename(old_path, new_path) < 0) { if (errno == ENOSPC) index->nodiskspace = TRUE; @@ -197,6 +194,9 @@ return FALSE; } + if (!mail_index_update_flags(index, rec, seq, flags, external_change)) + return FALSE; + return TRUE; }