nfs4: Fix error handling problems in FileInfo::UpdateFileHandles()
This commit is contained in:
parent
7ef9380fb3
commit
ea70f0aa5c
@ -14,13 +14,17 @@
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
sParsePath(RequestBuilder& req, uint32* count, const char* _path)
|
ParsePath(RequestBuilder& req, uint32& count, const char* _path)
|
||||||
{
|
{
|
||||||
char* path = strdup(_path);
|
char* path = strdup(_path);
|
||||||
|
if (path == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
char* pathStart = path;
|
char* pathStart = path;
|
||||||
char* pathEnd;
|
char* pathEnd;
|
||||||
|
|
||||||
while (pathStart != NULL) {
|
while (pathStart != NULL) {
|
||||||
pathEnd = strpbrk(pathStart, "/");
|
pathEnd = strchr(pathStart, '/');
|
||||||
if (pathEnd != NULL)
|
if (pathEnd != NULL)
|
||||||
*pathEnd = '\0';
|
*pathEnd = '\0';
|
||||||
|
|
||||||
@ -31,7 +35,7 @@ sParsePath(RequestBuilder& req, uint32* count, const char* _path)
|
|||||||
else
|
else
|
||||||
pathStart = NULL;
|
pathStart = NULL;
|
||||||
|
|
||||||
(*count)++;
|
count++;
|
||||||
}
|
}
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
@ -48,9 +52,15 @@ FileInfo::UpdateFileHandles(Filesystem* fs)
|
|||||||
req.PutRootFH();
|
req.PutRootFH();
|
||||||
|
|
||||||
uint32 lookupCount = 0;
|
uint32 lookupCount = 0;
|
||||||
|
status_t result;
|
||||||
|
|
||||||
sParsePath(req, &lookupCount, fs->Path());
|
result = ParsePath(req, lookupCount, fs->Path());
|
||||||
sParsePath(req, &lookupCount, fPath);
|
if (result != B_OK)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
result = ParsePath(req, lookupCount, fPath);
|
||||||
|
if (result != B_OK)
|
||||||
|
return result;
|
||||||
|
|
||||||
if (fs->IsAttrSupported(FATTR4_FILEID)) {
|
if (fs->IsAttrSupported(FATTR4_FILEID)) {
|
||||||
AttrValue attr;
|
AttrValue attr;
|
||||||
@ -64,7 +74,7 @@ FileInfo::UpdateFileHandles(Filesystem* fs)
|
|||||||
req.LookUpUp();
|
req.LookUpUp();
|
||||||
req.GetFH();
|
req.GetFH();
|
||||||
|
|
||||||
status_t result = request.Send();
|
result = request.Send();
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -84,7 +94,8 @@ FileInfo::UpdateFileHandles(Filesystem* fs)
|
|||||||
if (reply.LookUpUp() == B_ENTRY_NOT_FOUND) {
|
if (reply.LookUpUp() == B_ENTRY_NOT_FOUND) {
|
||||||
fParent = fHandle;
|
fParent = fHandle;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
} else
|
}
|
||||||
return reply.GetFH(&fParent);
|
|
||||||
|
return reply.GetFH(&fParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user