vfs/fs_truncate.c:Add socket judgment to return correct errno.

This commit is contained in:
crafcat7 2023-01-17 00:08:54 +08:00 committed by Xiang Xiao
parent a70a9f5ae6
commit 047f7f8d3a

View File

@ -51,6 +51,7 @@ static int sock_file_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
static int sock_file_poll(FAR struct file *filep, struct pollfd *fds,
bool setup);
static int sock_file_truncate(FAR struct file *filep, off_t length);
/****************************************************************************
* Private Data
@ -65,7 +66,7 @@ static const struct file_operations g_sock_fileops =
NULL, /* seek */
sock_file_ioctl, /* ioctl */
NULL, /* mmap */
NULL, /* truncate */
sock_file_truncate, /* truncate */
sock_file_poll /* poll */
};
@ -140,6 +141,11 @@ static int sock_file_poll(FAR struct file *filep, FAR struct pollfd *fds,
return psock_poll(filep->f_priv, fds, setup);
}
static int sock_file_truncate(FAR struct file *filep, off_t length)
{
return -EINVAL;
}
/****************************************************************************
* Public Functions
****************************************************************************/