Check for a valid pagesize in mkswap(8)
This commit is contained in:
parent
9c37575961
commit
41769b976a
5
mkswap.c
5
mkswap.c
@ -45,7 +45,12 @@ main(int argc, char *argv[])
|
|||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
pagesize = sysconf(_SC_PAGESIZE);
|
||||||
|
if (pagesize <= 0) {
|
||||||
pagesize = sysconf(_SC_PAGE_SIZE);
|
pagesize = sysconf(_SC_PAGE_SIZE);
|
||||||
|
if (pagesize <= 0)
|
||||||
|
enprintf(EXIT_FAILURE, "can't determine pagesize\n");
|
||||||
|
}
|
||||||
|
|
||||||
fd = open(argv[0], O_RDWR);
|
fd = open(argv[0], O_RDWR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user