getty: more correct check for O_RDWR