From d1e082889f2cba17675eea07554a03a01ea8e75d Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 24 Jun 2014 17:51:29 +0100 Subject: [PATCH] fix guess prefix oop, basename / dirname swapped --- ChangeLog | 1 + libvips/iofuncs/init.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc906a48..354b9f2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 24/6/14 started 7.40.1 - revise man.1 pages +- fix vips_guess_prefix() 23/6/14 started 7.40.0 - version bump diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index c6e63d4b..8c8311bb 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -819,7 +819,7 @@ const char * vips_guess_prefix( const char *argv0, const char *env_name ) { const char *prefix; - char *dirname; + char *basename; char name[VIPS_PATH_MAX]; /* Already set? @@ -834,20 +834,20 @@ vips_guess_prefix( const char *argv0, const char *env_name ) /* Get the program name from argv0. */ - dirname = g_path_get_dirname( argv0 ); + basename = g_path_get_basename( argv0 ); /* Add the exe suffix, if it's missing. */ if( strlen( VIPS_EXEEXT ) > 0 ) { const char *olds[] = { VIPS_EXEEXT }; - vips__change_suffix( dirname, name, + vips__change_suffix( basename, name, VIPS_PATH_MAX, VIPS_EXEEXT, olds, 1 ); } else - vips_strncpy( name, dirname, VIPS_PATH_MAX ); + vips_strncpy( name, basename, VIPS_PATH_MAX ); - g_free( dirname ); + g_free( basename ); #ifdef DEBUG printf( "vips_guess_prefix: argv0 = %s\n", argv0 );