CID 316: If path can be null, path->InitCheck() shouldn't be used. Split it up

into two seperate checks instead and return B_BAD_VALUE on a passed NULL path.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27475 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-09-13 13:43:50 +00:00
parent 020f56a07f
commit b1effc0c77
@@ -187,8 +187,12 @@ KFileDiskDevice::_UnregisterDevice(const char *_device)
status_t status_t
KFileDiskDevice::_GetDirectoryPath(partition_id id, KPath *path) KFileDiskDevice::_GetDirectoryPath(partition_id id, KPath *path)
{ {
if (!path || path->InitCheck() != B_OK) if (path == NULL)
return B_BAD_VALUE;
if (path->InitCheck() != B_OK)
return path->InitCheck(); return path->InitCheck();
status_t error = path->SetPath(kFileDevicesDir); status_t error = path->SetPath(kFileDevicesDir);
if (error == B_OK) { if (error == B_OK) {
char idBuffer[12]; char idBuffer[12];