Files
libguestfs/lib
Laszlo Ersek 421ab66c8c lib/proto: suppress "may be used uninitialized" in send_file_complete()
gcc emits the following warning:

> proto.c: In function ‘send_file_complete’:
> proto.c:437:10: error: ‘buf’ may be used uninitialized
> [-Werror=maybe-uninitialized]
>   437 |   return send_file_chunk (g, 0, buf, 0);
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In theory, passing the 1-byte array "buf", with indeterminate contents, to
xdr_bytes() ultimately, could be fine -- assuming xdr_bytes() never reads
the contents of the buffer, due to the buffer size being zero. However,
the xdr_bytes() manual does not seem to guarantee this (it also does not
explicitly permit passing a NULL buffer alongside size=0, which would be
even simpler for the caller).

In order to shut up the compiler, just zero-initialize the buffer --
that's simpler than adding diagnostics pragmas. The "maybe-uninitialized"
warning is otherwise very useful, so keep it globally enabled (per
WARN_CFLAGS / WERROR_CFLAGS).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211011223627.20856-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-12-09 13:54:15 +00:00
..
2020-03-06 19:32:32 +00:00
2021-01-28 14:04:29 +00:00
2020-08-24 16:24:38 +01:00
2020-03-06 19:32:32 +00:00
2017-01-26 15:05:46 +00:00
2020-03-06 19:32:32 +00:00
2021-04-13 15:40:48 +01:00
2021-04-08 11:12:17 +01:00
2021-04-08 11:12:17 +01:00
2017-01-26 15:05:46 +00:00
2021-09-13 10:40:50 +01:00
2020-03-06 19:32:32 +00:00
2020-03-06 19:32:32 +00:00
2020-03-06 19:32:32 +00:00
2017-01-26 15:05:46 +00:00
2021-04-08 11:12:17 +01:00
2021-04-08 11:12:17 +01:00
2017-01-26 15:05:46 +00:00
2017-01-26 15:05:46 +00:00
2020-03-06 19:32:32 +00:00
2017-01-26 15:05:46 +00:00
2020-03-06 19:32:32 +00:00