Fix return value and fix arguments check

Arguments error: return 1
mmap failed: return 2