Browse Source

Merge pull request #744 from Kizuna-Meraki/close-random

Close file on error path.
tags/json-c-0.16-20220414
Eric Hawicz GitHub 3 years ago
parent
commit
a1ea216878
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      random_seed.c

+ 3
- 1
random_seed.c View File

@@ -237,13 +237,15 @@ static int get_dev_random_seed(int *seed)
}

ssize_t nread = read(fd, seed, sizeof(*seed));

close(fd);

if (nread != sizeof(*seed))
{
fprintf(stderr, "error short read %s: %s", dev_random_file, strerror(errno));
return -1;
}

close(fd);
return 0;
}



Loading…
Cancel
Save