No longer use user_strcpy() but user_strlcpy().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
083d73d739
commit
26b91cb6ec
@ -742,7 +742,7 @@ bootfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
{
|
||||
struct bootfs_cookie *cookie = _cookie;
|
||||
struct bootfs *fs = _fs;
|
||||
status_t status;
|
||||
status_t status = B_OK;
|
||||
|
||||
TRACE(("bootfs_read_dir(fs_volume = %p vnode = %p, fs_cookie = %p, buffer = %p, bufferSize = %ld, num = %ld)\n",_fs, _vnode, cookie, dirent, bufferSize, *_num));
|
||||
|
||||
@ -750,7 +750,6 @@ bootfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
|
||||
if (cookie->u.dir.ptr == NULL) {
|
||||
*_num = 0;
|
||||
status = B_OK;
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -763,11 +762,12 @@ bootfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
goto err;
|
||||
}
|
||||
|
||||
status = user_strcpy(dirent->d_name, cookie->u.dir.ptr->name);
|
||||
status = user_strlcpy(dirent->d_name, cookie->u.dir.ptr->name, bufferSize - sizeof(struct dirent));
|
||||
if (status < B_OK)
|
||||
goto err;
|
||||
|
||||
cookie->u.dir.ptr = cookie->u.dir.ptr->dir_next;
|
||||
status = B_OK;
|
||||
|
||||
err:
|
||||
mutex_unlock(&fs->lock);
|
||||
|
@ -797,7 +797,7 @@ devfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
{
|
||||
struct devfs_cookie *cookie = _cookie;
|
||||
struct devfs *fs = _fs;
|
||||
status_t status = 0;
|
||||
status_t status = B_OK;
|
||||
|
||||
TRACE(("devfs_read_dir: vnode %p, cookie %p, buffer %p, size %ld\n", _vnode, cookie, dirent, bufferSize));
|
||||
|
||||
@ -808,7 +808,6 @@ devfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
|
||||
if (cookie->u.dir.ptr == NULL) {
|
||||
*_num = 0;
|
||||
status = B_OK;
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -821,11 +820,12 @@ devfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
goto err;
|
||||
}
|
||||
|
||||
status = user_strcpy(dirent->d_name, cookie->u.dir.ptr->name);
|
||||
if (status < 0)
|
||||
status = user_strlcpy(dirent->d_name, cookie->u.dir.ptr->name, bufferSize - sizeof(struct dirent));
|
||||
if (status < B_OK)
|
||||
goto err;
|
||||
|
||||
cookie->u.dir.ptr = cookie->u.dir.ptr->dir_next;
|
||||
status = B_OK;
|
||||
|
||||
err:
|
||||
mutex_unlock(&fs->lock);
|
||||
|
@ -637,7 +637,7 @@ rootfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
{
|
||||
struct rootfs_cookie *cookie = _cookie;
|
||||
struct rootfs *fs = _fs;
|
||||
status_t status = 0;
|
||||
status_t status = B_OK;
|
||||
|
||||
TRACE(("rootfs_read_dir: vnode %p, cookie %p, buffer = %p, bufferSize = %ld, num = %p\n", _vnode, cookie, dirent, bufferSize,_num));
|
||||
|
||||
@ -646,7 +646,6 @@ rootfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
if (cookie->ptr == NULL) {
|
||||
// we're at the end of the directory
|
||||
*_num = 0;
|
||||
status = B_OK;
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -659,11 +658,12 @@ rootfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent
|
||||
goto err;
|
||||
}
|
||||
|
||||
status = user_strcpy(dirent->d_name, cookie->ptr->name);
|
||||
if (status < 0)
|
||||
status = user_strlcpy(dirent->d_name, cookie->ptr->name, bufferSize - sizeof(struct dirent));
|
||||
if (status < B_OK)
|
||||
goto err;
|
||||
|
||||
cookie->ptr = cookie->ptr->dir_next;
|
||||
status = B_OK;
|
||||
|
||||
err:
|
||||
mutex_unlock(&fs->lock);
|
||||
|
Loading…
Reference in New Issue
Block a user