From c036a43801d60b620262687e4bb6d98f97e23dbd Mon Sep 17 00:00:00 2001 From: Connor Kuehl Date: Sat, 31 Oct 2020 17:51:39 -0500 Subject: [PATCH] Initialize result if res != GEMINI_OK My compiler barks about this unitialized variable: CC src/gmnlm.o src/gmnlm.c:629:7: error: variable 'result' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (res != GEMINI_OK) { ^~~~~~~~~~~~~~~~ src/gmnlm.c:673:9: note: uninitialized use occurs here return result; ^~~~~~ src/gmnlm.c:629:3: note: remove the 'if' if its condition is always false if (res != GEMINI_OK) { ^~~~~~~~~~~~~~~~~~~~~~~ src/gmnlm.c:482:2: note: variable 'result' is declared here enum prompt_result result; ^ 1 error generated. make: *** [src/gmnlm.o] Error 1 --- src/gmnlm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gmnlm.c b/src/gmnlm.c index 2fba84e..da43dbe 100644 --- a/src/gmnlm.c +++ b/src/gmnlm.c @@ -629,6 +629,7 @@ do_prompts(const char *prompt, struct browser *browser) if (res != GEMINI_OK) { fprintf(stderr, "Error: %s\n", gemini_strerr(res, &resp)); + result = PROMPT_AGAIN; goto exit; } pipe_resp(browser->tty, resp, &in[1]);