When the is_s390_dump() function is called to determine whether

a file is an s390 dumpfile, it currently presumes that the fopen()
call always works, and then tries to read it with using a NULL file
pointer.  Change it to verify that the fopen() was successful, and
if not, print an error message as is done with the other dumpfile
type verifier functions.
(ramin.blackhat@gmail.com)
This commit is contained in:
Dave Anderson 2019-04-01 11:56:41 -04:00
parent 9166dd323f
commit 31418015ee
1 changed files with 4 additions and 0 deletions

View File

@ -30,6 +30,10 @@ is_s390_dump(char *file)
int rc;
fh = fopen(file,"r");
if (fh == NULL) {
error(INFO, "is_s390_dump: cannot open %s: %s\n", file);
return FALSE;
}
items = fread(&magic, sizeof(magic), 1,fh);
if(magic == 0xa8190173618f23fdLL)
rc = TRUE;