[vlc-devel] [PATCH 2/2] file: pass standard error codes upward
RĂ©mi Denis-Courmont
remi at remlab.net
Sun May 19 19:46:50 CEST 2019
---
modules/access/file.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/modules/access/file.c b/modules/access/file.c
index 85e3d92015..bff2e6dda2 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -162,7 +162,7 @@ int FileOpen( vlc_object_t *p_this )
else
{
if (unlikely(p_access->psz_filepath == NULL))
- return VLC_EGENERIC;
+ return -EINVAL;
fd = vlc_open (p_access->psz_filepath, O_RDONLY | O_NONBLOCK);
}
@@ -172,7 +172,7 @@ int FileOpen( vlc_object_t *p_this )
p_access->psz_filepath ? p_access->psz_filepath
: p_access->psz_location,
vlc_strerror_c(errno));
- return VLC_EGENERIC;
+ return -errno;
}
struct stat st;
@@ -238,11 +238,11 @@ int FileOpen( vlc_object_t *p_this )
p_sys->b_pace_control = strcasecmp (p_access->psz_name, "stream");
}
- return VLC_SUCCESS;
+ return 0;
error:
vlc_close (fd);
- return VLC_EGENERIC;
+ return -errno;
}
/*****************************************************************************
@@ -294,7 +294,7 @@ static int FileSeek (stream_t *p_access, uint64_t i_pos)
access_sys_t *sys = p_access->p_sys;
if (lseek(sys->fd, i_pos, SEEK_SET) == (off_t)-1)
- return VLC_EGENERIC;
+ return -errno;
return VLC_SUCCESS;
}
@@ -302,7 +302,7 @@ static int NoSeek (stream_t *p_access, uint64_t i_pos)
{
/* vlc_assert_unreachable(); ?? */
(void) p_access; (void) i_pos;
- return VLC_EGENERIC;
+ return -ENOTSUP;
}
/*****************************************************************************
@@ -353,8 +353,8 @@ static int FileControl( stream_t *p_access, int i_query, va_list args )
break;
default:
- return VLC_EGENERIC;
+ return -ENOTSUP;
}
- return VLC_SUCCESS;
+ return 0;
}
--
2.20.1
More information about the vlc-devel
mailing list