From 0bc49a485efd060b09bfd35d6f3da5a676efe894 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 27 Nov 2019 15:14:42 +0000 Subject: [PATCH] remove use of realpath It won't work on linux systems with grsec. --- ChangeLog | 1 + libvips/iofuncs/util.c | 21 ++------------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86588ea9..39374879 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 17/9/19 started 8.8.4 - improve compatibility with older imagemagick versions +- remove realpath, since it can fail on systems with grsec 31/8/19 started 8.8.3 - revert sharpen restoring the input colourspace diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c index efb4643e..d38bcb7c 100644 --- a/libvips/iofuncs/util.c +++ b/libvips/iofuncs/util.c @@ -1873,25 +1873,10 @@ vips_realpath( const char *path ) { char *real; -#ifdef HAVE_REALPATH -{ - char buf[PATH_MAX]; - - /* More modern realpath() allow NULL for the second param, but we want - * to work with older libc as well. + /* It'd be nice to use realpath here, but sadly that won't work on + * linux systems with grsec, since it works by opening /proc/self/fd. */ - if( !(real = realpath( path, buf )) ) { - vips_error_system( errno, "vips_realpath", - "%s", _( "unable to form filename" ) ); - return( NULL ); - } - /* We must return a path that can be freed with g_free(). - */ - real = g_strdup( real ); -} -#else /*!HAVE_REALPATH*/ -{ if( !g_path_is_absolute( path ) ) { char *cwd; @@ -1901,8 +1886,6 @@ vips_realpath( const char *path ) } else real = g_strdup( path ); -} -#endif return( real ); }