diff --git a/libvips/iofuncs/source.c b/libvips/iofuncs/source.c index 880c8bad..cc3764de 100644 --- a/libvips/iofuncs/source.c +++ b/libvips/iofuncs/source.c @@ -153,8 +153,7 @@ vips_source_test_features( VipsSource *source ) * vips_source_seek() etc. or we might trigger seek emulation. */ if( source->data || - (VIPS_CONNECTION( source )->descriptor != -1 && - class->seek( source, 0, SEEK_CUR ) != -1) ) { + class->seek( source, 0, SEEK_CUR ) != -1 ) { gint64 length; VIPS_DEBUG_MSG( " seekable source\n" ); @@ -349,16 +348,15 @@ vips_source_seek_real( VipsSource *source, gint64 offset, int whence ) { VipsConnection *connection = VIPS_CONNECTION( source ); - gint64 new_pos; - VIPS_DEBUG_MSG( "vips_source_seek_real:\n" ); /* Like _read_real(), we must not set a vips_error. We need to use the * vips__seek() wrapper so we can seek long files on Windows. */ - new_pos = vips__seek_no_error( connection->descriptor, offset, whence ); + if( connection->descriptor != -1 ) + return( vips__seek_no_error( connection->descriptor, offset, whence ) ); - return( new_pos ); + return( -1 ); } static void