mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Fix ENOTSUP usage.
Remove E_NOTSUPP define. Use ENOTSUP directly where required. (vfs_clone_file): use ENOTSUP instead of EOPNOTSUPP. (mc_open): likewize. Fix sign. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
5f746eea0c
commit
666586e41a
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
Written by:
|
Written by:
|
||||||
Slava Zanko <slavazanko@gmail.com>, 2011, 2013
|
Slava Zanko <slavazanko@gmail.com>, 2011, 2013
|
||||||
|
Andrew Borodin <aborodin@vmail.ru>, 2011-2022
|
||||||
|
|
||||||
This file is part of the Midnight Commander.
|
This file is part of the Midnight Commander.
|
||||||
|
|
||||||
@ -219,7 +220,7 @@ mc_open (const vfs_path_t * vpath, int flags, ...)
|
|||||||
result = vfs_new_handle (path_element->class, info);
|
result = vfs_new_handle (path_element->class, info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
errno = -EOPNOTSUPP;
|
errno = ENOTSUP;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -243,7 +244,7 @@ int mc_##name inarg \
|
|||||||
\
|
\
|
||||||
result = path_element->class->name != NULL ? path_element->class->name callarg : -1; \
|
result = path_element->class->name != NULL ? path_element->class->name callarg : -1; \
|
||||||
if (result == -1) \
|
if (result == -1) \
|
||||||
errno = path_element->class->name != NULL ? vfs_ferrno (path_element->class) : E_NOTSUPP; \
|
errno = path_element->class->name != NULL ? vfs_ferrno (path_element->class) : ENOTSUP; \
|
||||||
return result; \
|
return result; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +280,7 @@ mc_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||||||
if (result == -1)
|
if (result == -1)
|
||||||
errno =
|
errno =
|
||||||
path_element->class->symlink != NULL ?
|
path_element->class->symlink != NULL ?
|
||||||
vfs_ferrno (path_element->class) : E_NOTSUPP;
|
vfs_ferrno (path_element->class) : ENOTSUP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -305,7 +306,7 @@ ssize_t mc_##name (int handle, C void *buf, size_t count) \
|
|||||||
\
|
\
|
||||||
result = vfs->name != NULL ? vfs->name (fsinfo, buf, count) : -1; \
|
result = vfs->name != NULL ? vfs->name (fsinfo, buf, count) : -1; \
|
||||||
if (result == -1) \
|
if (result == -1) \
|
||||||
errno = vfs->name != NULL ? vfs_ferrno (vfs) : E_NOTSUPP; \
|
errno = vfs->name != NULL ? vfs_ferrno (vfs) : ENOTSUP; \
|
||||||
return result; \
|
return result; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +342,7 @@ int mc_##name (const vfs_path_t *vpath1, const vfs_path_t *vpath2) \
|
|||||||
result = path_element1->class->name != NULL \
|
result = path_element1->class->name != NULL \
|
||||||
? path_element1->class->name (vpath1, vpath2) : -1; \
|
? path_element1->class->name (vpath1, vpath2) : -1; \
|
||||||
if (result == -1) \
|
if (result == -1) \
|
||||||
errno = path_element1->class->name != NULL ? vfs_ferrno (path_element1->class) : E_NOTSUPP; \
|
errno = path_element1->class->name != NULL ? vfs_ferrno (path_element1->class) : ENOTSUP; \
|
||||||
return result; \
|
return result; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,14 +428,14 @@ mc_opendir (const vfs_path_t * vpath)
|
|||||||
path_element = (vfs_path_element_t *) vfs_path_get_by_index (vpath, -1);
|
path_element = (vfs_path_element_t *) vfs_path_get_by_index (vpath, -1);
|
||||||
if (!vfs_path_element_valid (path_element))
|
if (!vfs_path_element_valid (path_element))
|
||||||
{
|
{
|
||||||
errno = E_NOTSUPP;
|
errno = ENOTSUP;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
info = path_element->class->opendir ? path_element->class->opendir (vpath) : NULL;
|
info = path_element->class->opendir ? path_element->class->opendir (vpath) : NULL;
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
{
|
{
|
||||||
errno = path_element->class->opendir ? vfs_ferrno (path_element->class) : E_NOTSUPP;
|
errno = path_element->class->opendir ? vfs_ferrno (path_element->class) : ENOTSUP;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +495,7 @@ mc_readdir (DIR * dirp)
|
|||||||
vfs_dirent_free (entry);
|
vfs_dirent_free (entry);
|
||||||
}
|
}
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
errno = vfs->readdir ? vfs_ferrno (vfs) : E_NOTSUPP;
|
errno = vfs->readdir ? vfs_ferrno (vfs) : ENOTSUP;
|
||||||
return (entry != NULL) ? mc_readdir_result : NULL;
|
return (entry != NULL) ? mc_readdir_result : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,7 +551,7 @@ mc_stat (const vfs_path_t * vpath, struct stat *buf)
|
|||||||
{
|
{
|
||||||
result = path_element->class->stat ? path_element->class->stat (vpath, buf) : -1;
|
result = path_element->class->stat ? path_element->class->stat (vpath, buf) : -1;
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
errno = path_element->class->name ? vfs_ferrno (path_element->class) : E_NOTSUPP;
|
errno = path_element->class->name ? vfs_ferrno (path_element->class) : ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -572,7 +573,7 @@ mc_lstat (const vfs_path_t * vpath, struct stat *buf)
|
|||||||
{
|
{
|
||||||
result = path_element->class->lstat ? path_element->class->lstat (vpath, buf) : -1;
|
result = path_element->class->lstat ? path_element->class->lstat (vpath, buf) : -1;
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
errno = path_element->class->name ? vfs_ferrno (path_element->class) : E_NOTSUPP;
|
errno = path_element->class->name ? vfs_ferrno (path_element->class) : ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -596,7 +597,7 @@ mc_fstat (int handle, struct stat *buf)
|
|||||||
|
|
||||||
result = vfs->fstat ? vfs->fstat (fsinfo, buf) : -1;
|
result = vfs->fstat ? vfs->fstat (fsinfo, buf) : -1;
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
errno = vfs->fstat ? vfs_ferrno (vfs) : E_NOTSUPP;
|
errno = vfs->fstat ? vfs_ferrno (vfs) : ENOTSUP;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,7 +746,7 @@ mc_lseek (int fd, off_t offset, int whence)
|
|||||||
|
|
||||||
result = vfs->lseek ? vfs->lseek (fsinfo, offset, whence) : -1;
|
result = vfs->lseek ? vfs->lseek (fsinfo, offset, whence) : -1;
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
errno = vfs->lseek ? vfs_ferrno (vfs) : E_NOTSUPP;
|
errno = vfs->lseek ? vfs_ferrno (vfs) : ENOTSUP;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
Written by: 1995 Miguel de Icaza
|
Written by: 1995 Miguel de Icaza
|
||||||
Jakub Jelinek, 1995
|
Jakub Jelinek, 1995
|
||||||
Pavel Machek, 1998
|
Pavel Machek, 1998
|
||||||
Slava Zanko <slavazanko@gmail.com>, 2013
|
Slava Zanko <slavazanko@gmail.com>, 2011-2013
|
||||||
|
Andrew Borodin <aborodin@vmail.ru>, 2011-2022
|
||||||
|
|
||||||
This file is part of the Midnight Commander.
|
This file is part of the Midnight Commander.
|
||||||
|
|
||||||
@ -746,7 +747,7 @@ vfs_clone_file (int dest_vfs_fd, int src_vfs_fd)
|
|||||||
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_class->flags & VFSF_LOCAL) == 0)
|
if ((dest_class->flags & VFSF_LOCAL) == 0)
|
||||||
{
|
{
|
||||||
errno = EOPNOTSUPP;
|
errno = ENOTSUP;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (dest_fd == NULL)
|
if (dest_fd == NULL)
|
||||||
@ -758,7 +759,7 @@ vfs_clone_file (int dest_vfs_fd, int src_vfs_fd)
|
|||||||
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_class->flags & VFSF_LOCAL) == 0)
|
if ((src_class->flags & VFSF_LOCAL) == 0)
|
||||||
{
|
{
|
||||||
errno = EOPNOTSUPP;
|
errno = ENOTSUP;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (src_fd == NULL)
|
if (src_fd == NULL)
|
||||||
@ -771,7 +772,7 @@ vfs_clone_file (int dest_vfs_fd, int src_vfs_fd)
|
|||||||
#else
|
#else
|
||||||
(void) dest_vfs_fd;
|
(void) dest_vfs_fd;
|
||||||
(void) src_vfs_fd;
|
(void) src_vfs_fd;
|
||||||
errno = EOPNOTSUPP;
|
errno = ENOTSUP;
|
||||||
return (-1);
|
return (-1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -72,12 +72,6 @@
|
|||||||
|
|
||||||
/* And now some defines for our errors. */
|
/* And now some defines for our errors. */
|
||||||
|
|
||||||
#ifdef ENOSYS
|
|
||||||
#define E_NOTSUPP ENOSYS /* for use in vfs when module does not provide function */
|
|
||||||
#else
|
|
||||||
#define E_NOTSUPP EFAULT /* Does this happen? */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENOMSG
|
#ifdef ENOMSG
|
||||||
#define E_UNKNOWN ENOMSG /* if we do not know what error happened */
|
#define E_UNKNOWN ENOMSG /* if we do not know what error happened */
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user