summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorSami Kerola2019-02-09 10:34:52 +0100
committerKarel Zak2019-02-18 13:19:24 +0100
commit4813a5210f6fb979d8f7a592f71a2f9c4d3db179 (patch)
tree90f4aafc604b9a676c0f614281076d8ab52686da /misc-utils
parentcal: fix Sexit and Senter (diff)
downloadkernel-qcow2-util-linux-4813a5210f6fb979d8f7a592f71a2f9c4d3db179.tar.gz
kernel-qcow2-util-linux-4813a5210f6fb979d8f7a592f71a2f9c4d3db179.tar.xz
kernel-qcow2-util-linux-4813a5210f6fb979d8f7a592f71a2f9c4d3db179.zip
various: fix 'uninitialized when used' warnings [clang]
This change fixes "warning: variable 'var' may be uninitialized when used here [-Wconditional-uninitialized]" warnings reported in various files. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/logger.c2
-rw-r--r--misc-utils/uuidd.c3
-rw-r--r--misc-utils/uuidparse.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 10b307ef9..394a477db 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -237,7 +237,7 @@ static int pencode(char *s)
static int unix_socket(struct logger_ctl *ctl, const char *path, int *socket_type)
{
- int fd, i, type = -1;
+ int fd = -1, i, type = -1;
static struct sockaddr_un s_addr; /* AF_UNIX address of local logger */
if (strlen(path) >= sizeof(s_addr.sun_path))
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index e0be809dd..0382bac47 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -313,7 +313,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
uuid_t uu;
char reply_buf[1024], *cp;
char op, str[UUID_STR_LEN];
- int i, ns, len, num;
+ int i, ns, len;
+ int num; /* intentionally uninitialized */
int s = 0;
int fd_pidfile = -1;
int ret;
diff --git a/misc-utils/uuidparse.c b/misc-utils/uuidparse.c
index 777f9db5e..6a13f2a2b 100644
--- a/misc-utils/uuidparse.c
+++ b/misc-utils/uuidparse.c
@@ -144,7 +144,7 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid)
size_t i;
uuid_t buf;
int invalid = 0;
- int variant, type;
+ int variant = -1, type = -1;
assert(tb);
assert(uuid);