From 9f4f50054302ce830a6d70711b8842f99829e3a2 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 3 Jan 2025 15:44:11 +0100 Subject: [PATCH] filesrc: Properly handle lseek return value On windows we use _lseeki64 which returns a guint64. The only error code lseek and _lseeki64 return is a casted -1, therefore just do that to handle all platforms Part-of: --- subprojects/gstreamer/plugins/elements/gstfilesrc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subprojects/gstreamer/plugins/elements/gstfilesrc.c b/subprojects/gstreamer/plugins/elements/gstfilesrc.c index 01d2ff6946..7c5712ae56 100644 --- a/subprojects/gstreamer/plugins/elements/gstfilesrc.c +++ b/subprojects/gstreamer/plugins/elements/gstfilesrc.c @@ -325,7 +325,7 @@ gst_file_src_fill (GstBaseSrc * basesrc, guint64 offset, guint length, off_t res; res = lseek (src->fd, offset, SEEK_SET); - if (G_UNLIKELY (res < 0 || res != offset)) + if (G_UNLIKELY (res == (off_t) - 1 || res != offset)) goto seek_failed; src->read_position = offset; @@ -546,14 +546,14 @@ gst_file_src_start (GstBaseSrc * basesrc) { off_t res = lseek (src->fd, 0, SEEK_END); - if (res < 0) { + if (res == (off_t) - 1) { GST_LOG_OBJECT (src, "disabling seeking, lseek failed: %s", g_strerror (errno)); src->seekable = FALSE; } else { res = lseek (src->fd, 0, SEEK_SET); - if (res < 0) { + if (res == (off_t) - 1) { /* We really don't like not being able to go back to 0 */ src->seekable = FALSE; goto lseek_wonky;