From: Peter Krempa <pkrempa@redhat.com> The instance of the 'disconnected' global variable in vsh.c is written-only, so can be removed. Caught by new clang: clang -Itools/libvirt_shell.a.p -Itools -I../tools -Iinclude -I../include -Isrc -I../src -Isrc/util -I../src/util -I. -I.. -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -O2 -g @/builds/libvirt/libvirt/build/c-warnings.txt -fPIC -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_FUNCTION_DEF -pthread -DWITH_GZFILEOP -MD -MQ tools/libvirt_shell.a.p/vsh.c.o -MF tools/libvirt_shell.a.p/vsh.c.o.d -o tools/libvirt_shell.a.p/vsh.c.o -c ../tools/vsh.c ../tools/vsh.c:242:12: error: variable 'disconnected' set but not used [-Werror,-Wunused-but-set-global] 242 | static int disconnected; /* we may have been disconnected */ | ^ 1 error generated. This instance exists since the 'vsh' module was split (834c5720e44). 'virsh' contains it's own instance. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tools/vsh.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 667cc1a0d2..d1540810ee 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -236,12 +236,6 @@ vshReportError(vshControl *ctl) vshResetLibvirtError(); } -/* - * Detection of disconnections and automatic reconnection support - */ -static int disconnected; /* we may have been disconnected */ - - /* vshCmddefSearch: * @cmdname: name of command to find * @@ -1392,16 +1386,6 @@ vshCommandRun(vshControl *ctl, after = g_get_real_time(); - /* try to automatically catch disconnections */ - if (ret != EXIT_SUCCESS && - ((last_error != NULL) && - (((last_error->code == VIR_ERR_SYSTEM_ERROR) && - (last_error->domain == VIR_FROM_REMOTE)) || - (last_error->code == VIR_ERR_RPC) || - (last_error->code == VIR_ERR_NO_CONNECT) || - (last_error->code == VIR_ERR_INVALID_CONN)))) - disconnected++; - if (ret != EXIT_SUCCESS) vshReportError(ctl); -- 2.55.0