mirror of
https://github.com/apache/nuttx.git
synced 2025-01-12 23:18:36 +08:00
v9fs/client.c:Use int ret as the return value to avoid uint32_t not supporting negative values
Summary: iModify the return variable in the v9fs_client_walk Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
parent
1f540a93d2
commit
6f4f50e2fe
1 changed files with 7 additions and 6 deletions
|
@ -1465,7 +1465,7 @@ int v9fs_client_walk(FAR struct v9fs_client_s *client, FAR const char *path,
|
||||||
struct iovec wiov[2];
|
struct iovec wiov[2];
|
||||||
struct iovec riov[2];
|
struct iovec riov[2];
|
||||||
uint16_t nwname = 0;
|
uint16_t nwname = 0;
|
||||||
uint32_t newfid;
|
uint32_t newfid = V9FS_NOFID;
|
||||||
size_t total_len = 0;
|
size_t total_len = 0;
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
size_t name_len;
|
size_t name_len;
|
||||||
|
@ -1526,12 +1526,13 @@ int v9fs_client_walk(FAR struct v9fs_client_s *client, FAR const char *path,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
newfid = v9fs_fid_create(client, path);
|
ret = v9fs_fid_create(client, path);
|
||||||
if (newfid < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newfid = ret;
|
||||||
request.header.size = V9FS_HDRSZ + V9FS_BIT32SZ * 2 + V9FS_BIT16SZ +
|
request.header.size = V9FS_HDRSZ + V9FS_BIT32SZ * 2 + V9FS_BIT16SZ +
|
||||||
total_len;
|
total_len;
|
||||||
request.header.type = V9FS_TWALK;
|
request.header.type = V9FS_TWALK;
|
||||||
|
@ -1586,7 +1587,7 @@ int v9fs_client_walk(FAR struct v9fs_client_s *client, FAR const char *path,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
v9fs_fid_destroy(client, newfid);
|
v9fs_fid_destroy(client, newfid);
|
||||||
newfid = ret;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There are differences in different server implementations, so it is
|
/* There are differences in different server implementations, so it is
|
||||||
|
@ -1596,13 +1597,13 @@ int v9fs_client_walk(FAR struct v9fs_client_s *client, FAR const char *path,
|
||||||
|
|
||||||
if (response.nwqid != nwname)
|
if (response.nwqid != nwname)
|
||||||
{
|
{
|
||||||
newfid = -ENOENT;
|
ret = -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
err:
|
err:
|
||||||
lib_put_pathbuffer(request_payload);
|
lib_put_pathbuffer(request_payload);
|
||||||
lib_put_pathbuffer(response_payload);
|
lib_put_pathbuffer(response_payload);
|
||||||
return newfid;
|
return ret == 0 ? newfid : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
Loading…
Reference in a new issue