zipl: fix -Wmaybe-uninitialized

Reported by GCC 9.2.1 when building with '-Wmaybe-uninitialized'.

job.c: In function 'job_get':
job.c:1817:14: warning: 'filename' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1817 |  scan_size = scan_file(filename, &scan);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
job.c:1791:14: note: 'filename' was declared here
 1791 |  const char *filename;
      |              ^~~~~~~~

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2019-10-24 08:17:19 +02:00
committed by Jan Höppner
parent bbc46edaf5
commit 2790d4faaa

View File

@@ -1788,7 +1788,7 @@ get_job_from_config_file(struct command_line* cmdline, struct job_data* job)
{
struct scan_token* scan;
struct scan_token* new_scan;
const char *filename;
const char *filename = NULL;
char *blsdir;
char* source;
int i, rc, scan_size;
@@ -1811,6 +1811,10 @@ get_job_from_config_file(struct command_line* cmdline, struct job_data* job)
break;
}
}
if (filename == NULL) {
error_text("No zipl configuration was readable");
return -1;
}
source = "";
}
printf("Using config file '%s'%s\n", filename, source);