mirror of
git://git.suckless.org/sbase
synced 2024-12-24 16:02:54 +00:00
Check mmap() return value and unmap at the end
This commit is contained in:
parent
38f429a3d2
commit
fe6144793f
4
tr.c
4
tr.c
@ -124,6 +124,8 @@ main(int argc, char *argv[])
|
||||
|
||||
mappings = (wchar_t *)mmap(NULL, 0x110000 * sizeof(wchar_t),
|
||||
PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
|
||||
if (mappings == MAP_FAILED)
|
||||
eprintf("mmap:");
|
||||
|
||||
ARGBEGIN {
|
||||
default:
|
||||
@ -147,5 +149,7 @@ main(int argc, char *argv[])
|
||||
if(ferror(stdin))
|
||||
eprintf("<stdin>: read error:");
|
||||
|
||||
munmap(mappings, 0x110000 * sizeof(wchar_t));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user