Infobar/Init: Improve status.sh check test and fix free mistake (segfault) in infobar_draw_statustext from philpep

This commit is contained in:
Martin Duquesnoy 2010-01-02 12:13:27 +01:00
parent d8f086868c
commit 8362a4ab68
2 changed files with 4 additions and 3 deletions

View File

@ -229,7 +229,6 @@ infobar_draw_statustext(int sc, char *str)
draw_text(infobar[sc].bar->dr, (sgeo[sc].width - SHADH) - textw(buf),
FHINFOBAR, col, 0, buf);
free(buf);
buf = _strdup(strwc);
++i;
}

View File

@ -202,16 +202,18 @@ init_status(void)
sprintf(status_path, "%s/"DEF_STATUS, getenv("HOME"));
if(!(fd = open(status_path, O_RDONLY)))
if(!(fd = open(status_path, O_RDONLY))
|| !fopen(status_path, "r"))
{
free(status_path);
estatus = False;
return;
}
stat(status_path, &st);
if(st.st_mode & S_IXUSR)
if(st.st_size && st.st_mode & S_IXUSR)
{
estatus = True;
system(status_path);