From 03d3e70eb8c4c9149c8aef4b29736217734daee2 Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Mon, 7 Oct 2002 12:10:47 +0000 Subject: [PATCH] On Darwin, basename returns a pointer to internal static storage space ... Is'nt that vicious. This would cause two successive basename to point on the same zone, which gave strange effects on command line reading (ex:BOOM) ... --- alliance/src/aut/src/autenv.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/alliance/src/aut/src/autenv.c b/alliance/src/aut/src/autenv.c index f12534c6..a409bfc1 100644 --- a/alliance/src/aut/src/autenv.c +++ b/alliance/src/aut/src/autenv.c @@ -45,6 +45,7 @@ # include # include # include +# include # include # include "aut.h" @@ -118,8 +119,16 @@ char *autbasename( Name, Extension ) { int Index; char *NewName; + char *NewNameTmp; - NewName = basename( mbkstrdup( Name ) ); + NewNameTmp = mbkstrdup( Name ); + + NewName = mbkstrdup (basename( NewNameTmp ) ); + /* We copy the result of basename because basename */ + /* can return a pointer to internal static storage */ + /* space on systems like Darwin */ + + mbkfree(NewNameTmp); if ( Extension != (char *)0 ) {