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) ...
This commit is contained in:
parent
d2fe4abb6a
commit
03d3e70eb8
|
@ -45,6 +45,7 @@
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
# include <libgen.h>
|
||||||
|
|
||||||
# include <mut.h>
|
# include <mut.h>
|
||||||
# include "aut.h"
|
# include "aut.h"
|
||||||
|
@ -118,8 +119,16 @@ char *autbasename( Name, Extension )
|
||||||
{
|
{
|
||||||
int Index;
|
int Index;
|
||||||
char *NewName;
|
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 )
|
if ( Extension != (char *)0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue