Richard W.M. Jones
2017-Apr-19 16:47 UTC
[Libguestfs] [PATCH] daemon: Add an assertion to suppress a warning with GCC.
swap.c: In function 'do_mkswap_U': swap.c:62:9: error: argument 1 null where non-null expected [-Werror=nonnull] if (strlen (label) > SWAP_LABEL_MAX) { ^~~~~~~~~~~~~~ --- daemon/swap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daemon/swap.c b/daemon/swap.c index 028bc1ee2..fea4a9dcf 100644 --- a/daemon/swap.c +++ b/daemon/swap.c @@ -22,6 +22,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <assert.h> #include "guestfs_protocol.h" #include "daemon.h" @@ -58,6 +59,7 @@ do_mkswap (const char *device, const char *label, const char *uuid) ADD_ARG (argv, i, "-f"); if (optargs_bitmask & GUESTFS_MKSWAP_LABEL_BITMASK) { + assert (label != NULL); /* suppress a warning with -O3 */ if (strlen (label) > SWAP_LABEL_MAX) { reply_with_error ("%s: Linux swap labels are limited to %d bytes", label, SWAP_LABEL_MAX); -- 2.12.0
Maybe Matching Threads
- [PATCH v2] daemon: Remove GUESTFSD_EXT_CMD.
- [PATCH 2/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.
- [PATCH v2] daemon: collect list of called external commands
- [PATCH] collect list of called external commands
- [PATCH V1] NEW API:ext:mke2fs