From 334beb1cfa3fb4129655360fb8d249a47c136f5f Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Thu, 20 Jan 2022 00:14:07 +0100 Subject: [PATCH] [httpd] Coverity fixups --- src/httpd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/httpd.c b/src/httpd.c index f0dc92b2..05144f14 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -1310,9 +1310,10 @@ httpd_stream_file(struct evhttp_request *req, int id) if (!transcode) { /* Hint the OS */ - posix_fadvise(st->fd, st->start_offset, st->stream_size, POSIX_FADV_WILLNEED); - posix_fadvise(st->fd, st->start_offset, st->stream_size, POSIX_FADV_SEQUENTIAL); - posix_fadvise(st->fd, st->start_offset, st->stream_size, POSIX_FADV_NOREUSE); + if ( (ret = posix_fadvise(st->fd, st->start_offset, st->stream_size, POSIX_FADV_WILLNEED)) != 0 || + (ret = posix_fadvise(st->fd, st->start_offset, st->stream_size, POSIX_FADV_SEQUENTIAL)) != 0 || + (ret = posix_fadvise(st->fd, st->start_offset, st->stream_size, POSIX_FADV_NOREUSE)) != 0 ) + DPRINTF(E_DBG, L_HTTPD, "posix_fadvise() failed with error %d\n", ret); } #endif @@ -1353,6 +1354,10 @@ httpd_gzip_deflate(struct evbuffer *in) strm.zfree = Z_NULL; strm.opaque = Z_NULL; + // Just to keep Coverity from complaining about uninitialized values + strm.total_in = 0; + strm.total_out = 0; + // Set up a gzip stream (the "+ 16" in 15 + 16), instead of a zlib stream (default) ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 + 16, 8, Z_DEFAULT_STRATEGY); if (ret != Z_OK)