* Aligned the semantics of the read_symlink() FS module hook with the

readlink() function. It is no longer required to null-terminate the
  string, shall not fail, if the buffer is too small, and shall return
  the length of the string actually written into the buffer.
* Adjusted rootfs, devfs, and bfs accordingly. Also adjusted their
  read_stat() hooks to return the correct symlink length in st_size.
* Our readlink() does now comply to the standard (and BeOS).
  Additionally if the buffer is big enough it is nice to non-conforming
  apps and null-terminates it.
* BSymLink::ReadLink() explicitly null-terminates the string now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24425 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-03-17 21:37:40 +00:00
parent 4f893e39ab
commit 1b32947d3f
9 changed files with 61 additions and 45 deletions
+13 -10
View File
@@ -1,9 +1,9 @@
/*
* Copyright 2007 Haiku Inc. All rights reserved.
* Copyright 2007-2008 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold
* Ingo Weinhold <[email protected]>
* Niels Sascha Reedijk <[email protected]>
* Axel Dörfler <[email protected]>
*
@@ -536,21 +536,24 @@
fs_vnode link, char *buffer, size_t *_bufferSize)
\brief Read the value of a symbolic link.
If the function is successful, the string written to the buffer shall be
null-terminated and the variable \a _bufferSize points to shall be set to
the length of that string, including the terminating null character.
If the function is successful, the symlink string shall be written to the
buffer. It does not need to be null-terminated. If the buffer is too small
to hold the complete string, only the first \c *_bufferSize bytes of the
string shall be written to the buffer; the buffer shall not be
null-terminated in this case. Furthermore the variable \a _bufferSize
points to shall be set to the length of the string written to the buffer,
not including any terminating null character (if written).
\param fs The volume handle.
\param link The node handle.
\param buffer Pointer to a pre-allocated buffer the link value shall be
written to.
\param buffer Pointer to a pre-allocated variable containing the size of the
buffer supplied to the function. Upon successful completion the hook shall
store the number of bytes actually written into the buffer in the variable.
\param _bufferSize Pointer to a pre-allocated variable containing the size
of the buffer supplied to the function. Upon successful completion the
hook shall store the number of bytes actually written into the buffer
in the variable.
\retval B_OK Everything went fine.
\retval B_BAD_VALUE \a link does not identify a symbolic link.
\retval B_BUFFER_OVERFLOW The supplied buffer is not big enough to contain
the complete link value.
*/
/*!