libroot_build: Add better error checking to _kern_dup.
This way, we will get a more coherent crash instead of an unceremonious one. Follow-up to #17389. Change-Id: Iffbf421ce85d638628243d5785ba61ff6b9a8043 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4729 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
23888052c9
commit
001e157a7b
@@ -117,7 +117,7 @@ utimes_helper(File& file, const struct timespec times[2])
|
|||||||
timeBuffer[1] = now;
|
timeBuffer[1] = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
return file.SetTimes(timeBuffer);
|
return file.SetTimes(timeBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _HAIKU_BUILD_NO_FUTIMENS || _HAIKU_BUILD_NO_FUTIMENS
|
#endif // _HAIKU_BUILD_NO_FUTIMENS || _HAIKU_BUILD_NO_FUTIMENS
|
||||||
@@ -811,10 +811,12 @@ _kern_dup(int fd)
|
|||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
|
|
||||||
// clone it
|
// clone it
|
||||||
Descriptor *clone;
|
Descriptor *clone = NULL;
|
||||||
status_t error = descriptor->Dup(clone);
|
status_t error = descriptor->Dup(clone);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
if (clone == NULL)
|
||||||
|
debugger("Dup() succeeded but descriptor is NULL");
|
||||||
|
|
||||||
return add_descriptor(clone);
|
return add_descriptor(clone);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user