e: fix #528
basename may modify its argument, so we need to strdup before calling basename. SVN revision: 48128
This commit is contained in:
parent
90517199bc
commit
52bb692ae8
|
@ -434,14 +434,18 @@ _e_exehist_limit(void)
|
||||||
static const char *
|
static const char *
|
||||||
_e_exehist_normalize_exe(const char *exe)
|
_e_exehist_normalize_exe(const char *exe)
|
||||||
{
|
{
|
||||||
char *base, *cp, *space = NULL;
|
char *base, *buf, *cp, *space = NULL;
|
||||||
const char *ret;
|
const char *ret;
|
||||||
Eina_Bool flag = EINA_FALSE;
|
Eina_Bool flag = EINA_FALSE;
|
||||||
|
|
||||||
base = basename((char *)exe);
|
buf = strdup(exe);
|
||||||
if ((base[0] == '.') && (base[1] == '\0')) return NULL;
|
base = basename(buf);
|
||||||
|
if ((base[0] == '.') && (base[1] == '\0'))
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
base = strdup(base);
|
|
||||||
cp = base;
|
cp = base;
|
||||||
while (*cp)
|
while (*cp)
|
||||||
{
|
{
|
||||||
|
@ -469,7 +473,7 @@ _e_exehist_normalize_exe(const char *exe)
|
||||||
if (space) *space = '\0';
|
if (space) *space = '\0';
|
||||||
|
|
||||||
ret = eina_stringshare_add(base);
|
ret = eina_stringshare_add(base);
|
||||||
free(base);
|
free(buf);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue