mirror of
git://sourceware.org/git/lvm2.git
synced 2025-08-02 04:22:02 +03:00
system_id: warn if the system_id_file cannot be opened
This commit is contained in:
@ -81,9 +81,10 @@ static char *_read_system_id_from_file(struct cmd_context *cmd, const char *file
|
||||
if (!file || !strlen(file) || !file[0])
|
||||
return NULL;
|
||||
|
||||
fp = fopen(file, "r");
|
||||
if (!fp)
|
||||
if (!(fp = fopen(file, "r"))) {
|
||||
log_warn("WARNING: Error %d opening system_id_file %s", errno, file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(line, 0, sizeof(line));
|
||||
|
||||
@ -91,11 +92,13 @@ static char *_read_system_id_from_file(struct cmd_context *cmd, const char *file
|
||||
if (line[0] == '#' || line[0] == '\n')
|
||||
continue;
|
||||
|
||||
fclose(fp);
|
||||
if (fclose(fp))
|
||||
stack;
|
||||
return system_id_from_string(cmd, line);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
if (fclose(fp))
|
||||
stack;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user