1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

system_id: warn if the system_id_file cannot be opened

This commit is contained in:
David Teigland 2015-02-13 11:37:11 -06:00
parent def0866ded
commit d726246f78

View File

@ -81,9 +81,10 @@ static char *_read_system_id_from_file(struct cmd_context *cmd, const char *file
if (!file || !strlen(file) || !file[0]) if (!file || !strlen(file) || !file[0])
return NULL; return NULL;
fp = fopen(file, "r"); if (!(fp = fopen(file, "r"))) {
if (!fp) log_warn("WARNING: Error %d opening system_id_file %s", errno, file);
return NULL; return NULL;
}
memset(line, 0, sizeof(line)); 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') if (line[0] == '#' || line[0] == '\n')
continue; continue;
fclose(fp); if (fclose(fp))
stack;
return system_id_from_string(cmd, line); return system_id_from_string(cmd, line);
} }
fclose(fp); if (fclose(fp))
stack;
return NULL; return NULL;
} }