Skip to content

Commit

Permalink
When the is_s390_dump() function is called to determine whether
Browse files Browse the repository at this point in the history
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.
([email protected])
  • Loading branch information
Dave Anderson committed Apr 1, 2019
1 parent 9166dd3 commit 3141801
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions s390_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3141801

Please sign in to comment.