mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
(vfs_clone_file): clarify errno in case of bad file descriptors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
0493a5e90e
commit
23a2056a18
@ -675,18 +675,28 @@ vfs_clone_file (int dest_vfs_fd, int src_vfs_fd)
|
|||||||
struct vfs_class *src_class;
|
struct vfs_class *src_class;
|
||||||
|
|
||||||
dest_class = vfs_class_find_by_handle (dest_vfs_fd, &dest_fd);
|
dest_class = vfs_class_find_by_handle (dest_vfs_fd, &dest_fd);
|
||||||
if (dest_fd == NULL || (dest_class->flags & VFSF_LOCAL) == 0)
|
if ((dest_class->flags & VFSF_LOCAL) == 0)
|
||||||
{
|
{
|
||||||
errno = EOPNOTSUPP;
|
errno = EOPNOTSUPP;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
if (dest_fd == NULL)
|
||||||
|
{
|
||||||
|
errno = EBADF;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
src_class = vfs_class_find_by_handle (src_vfs_fd, &src_fd);
|
src_class = vfs_class_find_by_handle (src_vfs_fd, &src_fd);
|
||||||
if (src_fd == NULL || (src_class->flags & VFSF_LOCAL) == 0)
|
if ((src_class->flags & VFSF_LOCAL) == 0)
|
||||||
{
|
{
|
||||||
errno = EOPNOTSUPP;
|
errno = EOPNOTSUPP;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
if (src_fd == NULL)
|
||||||
|
{
|
||||||
|
errno = EBADF;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
return ioctl (*(int *) dest_fd, FICLONE, *(int *) src_fd);
|
return ioctl (*(int *) dest_fd, FICLONE, *(int *) src_fd);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user