Commit | Line | Data |
---|---|---|
0e66f4a1 TGR |
1 | From: Tobias Geerinckx-Rice <me@tobias.gr> |
2 | Date: Mon, 25 Jun 2018 00:34:52 +0200 | |
3 | Subject: dovecot-trees: Fix build with dovecot 2.3. | |
4 | ||
5 | The following patch was taken verbatim from the upstream repository[0] | |
6 | and will be included in the next release. | |
7 | ||
8 | [0]: https://0xacab.org/riseuplabs/trees/commit/e136c32a044701d68b0235b8405357c5fca62a11 | |
9 | --- | |
10 | From e136c32a044701d68b0235b8405357c5fca62a11 Mon Sep 17 00:00:00 2001 | |
11 | From: David Goulet <dgoulet@ev0ke.net> | |
12 | Date: Tue, 10 Apr 2018 13:48:01 -0400 | |
13 | Subject: [PATCH] Support dovecot 2.3 | |
14 | ||
15 | Untested but it builds now properly. Thanks to "smorks" for the report! | |
16 | ||
17 | Fixes #16 | |
18 | ||
19 | Signed-off-by: David Goulet <dgoulet@ev0ke.net> | |
20 | --- | |
21 | src/trees-istream.c | 4 ++++ | |
22 | src/trees-ostream.c | 7 +++++++ | |
23 | 2 files changed, 11 insertions(+) | |
24 | ||
25 | diff --git a/src/trees-istream.c b/src/trees-istream.c | |
26 | index b08ff16..e94be7d 100644 | |
27 | --- a/src/trees-istream.c | |
28 | +++ b/src/trees-istream.c | |
29 | @@ -431,5 +431,9 @@ trees_istream_create(struct istream *input, | |
30 | sstream->out_byte_count = 0; | |
31 | #endif | |
32 | ||
33 | +#if DOVECOT_PREREQ(2, 3) | |
34 | + return i_stream_create(&sstream->istream, input, i_stream_get_fd(input), 0); | |
35 | +#else | |
36 | return i_stream_create(&sstream->istream, input, i_stream_get_fd(input)); | |
37 | +#endif /* DOVECOT_PREREQ */ | |
38 | } | |
39 | diff --git a/src/trees-ostream.c b/src/trees-ostream.c | |
40 | index 1b25a91..0cb7867 100644 | |
41 | --- a/src/trees-ostream.c | |
42 | +++ b/src/trees-ostream.c | |
43 | @@ -174,7 +174,14 @@ trees_ostream_sendv(struct ostream_private *stream, | |
44 | static int | |
45 | trees_ostream_flush(struct ostream_private *stream) | |
46 | { | |
47 | + /* This is pretty ugly but unfortunately between 2.2 and 2.3, Dovecot changed | |
48 | + * the expected value to be non zero in 2.3+ . */ | |
49 | +#if DOVECOT_PREREQ(2, 3) | |
50 | + ssize_t result = 1; | |
51 | +#else | |
52 | ssize_t result = 0; | |
53 | +#endif /* DOVECOT_PREREQ */ | |
54 | + | |
55 | struct trees_ostream *sstream = (struct trees_ostream *) stream; | |
56 | ||
57 | if (sstream->flushed) { | |
58 | -- | |
59 | 2.17.1 | |
60 |