1
0
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:
sin 2014-01-20 11:25:57 +00:00
parent 38f429a3d2
commit fe6144793f

4
tr.c
View File

@ -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;
}