From 9b4bb51c2eb505b35b47e48cba004485ba929aab Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 7 Apr 2016 04:20:09 +0200 Subject: [PATCH] Cleanup filestream_tell --- libretro-common/streams/file_stream.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index a1e7359879..45e57f95eb 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -308,12 +308,12 @@ ssize_t filestream_tell(RFILE *stream) if (!stream) goto error; #if defined(VITA) || defined(PSP) - return sceIoLseek(stream->fd, 0, SEEK_CUR); + if (sceIoLseek(stream->fd, 0, SEEK_CUR) < 0) + goto error; #elif defined(__CELLOS_LV2__) uint64_t pos = 0; if (cellFsLseek(stream->fd, 0, CELL_FS_SEEK_CUR, &pos) != CELL_FS_SUCCEEDED) goto error; - return 0; #else #if defined(HAVE_BUFFERED_IO) if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) @@ -325,9 +325,12 @@ ssize_t filestream_tell(RFILE *stream) if (stream->mapped && stream->hints & RFILE_HINT_MMAP) return stream->mappos; #endif - return lseek(stream->fd, 0, SEEK_CUR); + if (lseek(stream->fd, 0, SEEK_CUR) < 0) + goto error; #endif + return 0; + error: return -1; }