But now it will only set a return value if retval != -1 - if it's -1, then the return value is unset (hence NULL).