From: Timo Sirainen Date: Tue, 15 Mar 2016 22:30:20 +0000 (+1100) Subject: dbox: Fixed pop3.order caching for mails without no specified order. X-Git-Tag: 2.2.22~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c99596a097bb4c33e639e1aa7398ac93f07fa8be;p=thirdparty%2Fdovecot%2Fcore.git dbox: Fixed pop3.order caching for mails without no specified order. --- diff --git a/src/lib-storage/index/dbox-common/dbox-mail.c b/src/lib-storage/index/dbox-common/dbox-mail.c index 3cfe90bba6..ddd93bdaa6 100644 --- a/src/lib-storage/index/dbox-common/dbox-mail.c +++ b/src/lib-storage/index/dbox-common/dbox-mail.c @@ -182,7 +182,15 @@ dbox_get_cached_metadata(struct dbox_mail *mail, enum dbox_metadata_key key, i_assert(str_len(str) == sizeof(order)); memcpy(&order, str_data(str), sizeof(order)); str_truncate(str, 0); - str_printfa(str, "%u", order); + if (order != 0) + str_printfa(str, "%u", order); + else { + /* order=0 means it doesn't exist. we don't + want to return "0" though, because then the + mails get ordered to beginning, while + nonexistent are supposed to be ordered at + the end. */ + } } *value_r = str_c(str); return 0;