{rootfs|devfs}_read_link() did not report the correct link size on
success (they just kept the passed in buffer size unchanged). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12821 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a460a8f084
commit
1333009e1c
@ -1150,14 +1150,16 @@ static status_t
|
||||
devfs_read_link(fs_volume _fs, fs_vnode _link, char *buffer, size_t *_bufferSize)
|
||||
{
|
||||
struct devfs_vnode *link = (struct devfs_vnode *)_link;
|
||||
size_t bufferSize = *_bufferSize;
|
||||
|
||||
if (!S_ISLNK(link->stream.type))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (*_bufferSize <= link->stream.u.symlink.length) {
|
||||
*_bufferSize = link->stream.u.symlink.length + 1;
|
||||
*_bufferSize = link->stream.u.symlink.length + 1;
|
||||
// we always need to return the number of bytes we intend to write!
|
||||
|
||||
if (bufferSize <= link->stream.u.symlink.length)
|
||||
return B_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
memcpy(buffer, link->stream.u.symlink.path, link->stream.u.symlink.length + 1);
|
||||
return B_OK;
|
||||
|
@ -784,14 +784,16 @@ static status_t
|
||||
rootfs_read_link(fs_volume _fs, fs_vnode _link, char *buffer, size_t *_bufferSize)
|
||||
{
|
||||
struct rootfs_vnode *link = _link;
|
||||
size_t bufferSize = *_bufferSize;
|
||||
|
||||
if (!S_ISLNK(link->stream.type))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (*_bufferSize <= link->stream.symlink.length) {
|
||||
*_bufferSize = link->stream.symlink.length + 1;
|
||||
*_bufferSize = link->stream.symlink.length + 1;
|
||||
// we always need to return the number of bytes we intend to write!
|
||||
|
||||
if (bufferSize <= link->stream.symlink.length)
|
||||
return B_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
memcpy(buffer, link->stream.symlink.path, link->stream.symlink.length + 1);
|
||||
return B_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user