From 5db4537f644c26cd59303f5c92fb6ba12e9f1d31 Mon Sep 17 00:00:00 2001 From: Guido Trentalancia Date: Fri, 23 Dec 2016 16:16:54 +0100 Subject: [PATCH] libselinux: Fix unitialized variable compiler warnings Fix unitialized variable compiler warnings when using the "-O3 -Werror" flags on gcc6 by initializing the variables in question. The variables were never used before being initialized. Signed-off-by: Guido Trentalancia Signed-off-by: James Carter --- libselinux/src/fgetfilecon.c | 2 +- libselinux/src/getfilecon.c | 2 +- libselinux/src/lgetfilecon.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libselinux/src/fgetfilecon.c b/libselinux/src/fgetfilecon.c index 3954e644..5522ac16 100644 --- a/libselinux/src/fgetfilecon.c +++ b/libselinux/src/fgetfilecon.c @@ -53,7 +53,7 @@ hidden_def(fgetfilecon_raw) int fgetfilecon(int fd, char ** context) { - char * rcontext; + char * rcontext = NULL; int ret; *context = NULL; diff --git a/libselinux/src/getfilecon.c b/libselinux/src/getfilecon.c index 5d4d4835..20bee8ab 100644 --- a/libselinux/src/getfilecon.c +++ b/libselinux/src/getfilecon.c @@ -54,7 +54,7 @@ hidden_def(getfilecon_raw) int getfilecon(const char *path, char ** context) { int ret; - char * rcontext; + char * rcontext = NULL; *context = NULL; diff --git a/libselinux/src/lgetfilecon.c b/libselinux/src/lgetfilecon.c index 478e0c6b..db67bc60 100644 --- a/libselinux/src/lgetfilecon.c +++ b/libselinux/src/lgetfilecon.c @@ -54,7 +54,7 @@ hidden_def(lgetfilecon_raw) int lgetfilecon(const char *path, char ** context) { int ret; - char * rcontext; + char * rcontext = NULL; *context = NULL;