vfs/fs_truncate.c:Add socket judgment to return correct errno.
This commit is contained in:
parent
a70a9f5ae6
commit
047f7f8d3a
@ -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
|
||||
@ -58,15 +59,15 @@ static int sock_file_poll(FAR struct file *filep, struct pollfd *fds,
|
||||
|
||||
static const struct file_operations g_sock_fileops =
|
||||
{
|
||||
sock_file_open, /* open */
|
||||
sock_file_close, /* close */
|
||||
sock_file_read, /* read */
|
||||
sock_file_write, /* write */
|
||||
NULL, /* seek */
|
||||
sock_file_ioctl, /* ioctl */
|
||||
NULL, /* mmap */
|
||||
NULL, /* truncate */
|
||||
sock_file_poll /* poll */
|
||||
sock_file_open, /* open */
|
||||
sock_file_close, /* close */
|
||||
sock_file_read, /* read */
|
||||
sock_file_write, /* write */
|
||||
NULL, /* seek */
|
||||
sock_file_ioctl, /* ioctl */
|
||||
NULL, /* mmap */
|
||||
sock_file_truncate, /* truncate */
|
||||
sock_file_poll /* poll */
|
||||
};
|
||||
|
||||
static struct inode g_sock_inode =
|
||||
@ -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
|
||||
****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user