]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-compression: Fix usage of i_stream_stat
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 3 Mar 2020 11:11:59 +0000 (13:11 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 6 Mar 2020 09:00:50 +0000 (09:00 +0000)
It was supposed to check that it succeeds, not fails.

src/lib-compression/istream-bzlib.c
src/lib-compression/istream-lz4.c
src/lib-compression/istream-lzma.c
src/lib-compression/istream-zlib.c

index 88e8652a104328abada91fdc9181385d1eeeecba..08910b2482441d783dc441133b55b8076b23d945 100644 (file)
@@ -192,7 +192,7 @@ static void i_stream_bzlib_sync(struct istream_private *stream)
        struct bzlib_istream *zstream = (struct bzlib_istream *) stream;
        const struct stat *st;
 
-       if (i_stream_stat(stream->parent, FALSE, &st) < 0) {
+       if (i_stream_stat(stream->parent, FALSE, &st) == 0) {
                if (memcmp(&zstream->last_parent_statbuf,
                           st, sizeof(*st)) == 0) {
                        /* a compressed file doesn't change unexpectedly,
index 53f7947679ec11a9fd6bef4b0f10f3a20c3cf990..5728fd17aaf4ffa035aa8177cb8f1b9415763d4e 100644 (file)
@@ -237,7 +237,7 @@ static void i_stream_lz4_sync(struct istream_private *stream)
        struct lz4_istream *zstream = (struct lz4_istream *) stream;
        const struct stat *st;
 
-       if (i_stream_stat(stream->parent, FALSE, &st) < 0) {
+       if (i_stream_stat(stream->parent, FALSE, &st) == 0) {
                if (memcmp(&zstream->last_parent_statbuf,
                           st, sizeof(*st)) == 0) {
                        /* a compressed file doesn't change unexpectedly,
index 83ee55b2e089c537b8bc519410ebf9e9b0532499..faee8a8217f2311f9de89f1016b48697c65edac3 100644 (file)
@@ -213,7 +213,7 @@ static void i_stream_lzma_sync(struct istream_private *stream)
        struct lzma_istream *zstream = (struct lzma_istream *) stream;
        const struct stat *st;
 
-       if (i_stream_stat(stream->parent, FALSE, &st) < 0) {
+       if (i_stream_stat(stream->parent, FALSE, &st) == 0) {
                if (memcmp(&zstream->last_parent_statbuf,
                           st, sizeof(*st)) == 0) {
                        /* a compressed file doesn't change unexpectedly,
index 7de770c307559cda2118441a50f5282f999c1b63..3e514cab84267090f7a09e59414b0dbbf333bcf8 100644 (file)
@@ -366,7 +366,7 @@ static void i_stream_zlib_sync(struct istream_private *stream)
        struct zlib_istream *zstream = (struct zlib_istream *) stream;
        const struct stat *st;
 
-       if (i_stream_stat(stream->parent, FALSE, &st) < 0) {
+       if (i_stream_stat(stream->parent, FALSE, &st) == 0) {
                if (memcmp(&zstream->last_parent_statbuf,
                           st, sizeof(*st)) == 0) {
                        /* a compressed file doesn't change unexpectedly,