mirror of
https://github.com/apache/nuttx.git
synced 2026-08-07 21:47:17 +00:00
ftruncate: sanity check for parameter:length
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
33d236121f
commit
e5f8acab97
1 changed files with 6 additions and 1 deletions
|
|
@ -155,7 +155,12 @@ int file_truncate(FAR struct file *filep, off_t length)
|
|||
int ftruncate(int fd, off_t length)
|
||||
{
|
||||
FAR struct file *filep;
|
||||
int ret;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (length < 0)
|
||||
{
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Get the file structure corresponding to the file descriptor. */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue