From 15e7e802456404d077bc23c6de01b5979f0a7484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 23 Jun 2021 15:32:03 +0200 Subject: [PATCH] =?UTF-8?q?client:=20make=20sure=20=E2=80=98fd=E2=80=99=20?= =?UTF-8?q?is=20initialized=20in=20all=20error=20paths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client.c b/client.c index 7249c588..95c57656 100644 --- a/client.c +++ b/client.c @@ -136,6 +136,7 @@ main(int argc, char *const *argv) uint64_t total_len = 0; /* malloc:ed and needs to be in scope of all goto's */ + int fd = -1; char *_cwd = NULL; override_list_t overrides = tll_init(); struct client_string *cargv = NULL; @@ -279,7 +280,7 @@ main(int argc, char *const *argv) log_init(log_colorize, false, LOG_FACILITY_USER, log_level); - int fd = socket(AF_UNIX, SOCK_STREAM, 0); + fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd == -1) { LOG_ERRNO("failed to create socket"); goto err;