Infobar/Init: Improve status.sh check test and fix free mistake (segfault) in infobar_draw_statustext from philpep
This commit is contained in:
parent
d8f086868c
commit
8362a4ab68
@ -229,7 +229,6 @@ infobar_draw_statustext(int sc, char *str)
|
|||||||
draw_text(infobar[sc].bar->dr, (sgeo[sc].width - SHADH) - textw(buf),
|
draw_text(infobar[sc].bar->dr, (sgeo[sc].width - SHADH) - textw(buf),
|
||||||
FHINFOBAR, col, 0, buf);
|
FHINFOBAR, col, 0, buf);
|
||||||
|
|
||||||
free(buf);
|
|
||||||
buf = _strdup(strwc);
|
buf = _strdup(strwc);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -202,16 +202,18 @@ init_status(void)
|
|||||||
|
|
||||||
sprintf(status_path, "%s/"DEF_STATUS, getenv("HOME"));
|
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);
|
free(status_path);
|
||||||
|
estatus = False;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stat(status_path, &st);
|
stat(status_path, &st);
|
||||||
|
|
||||||
if(st.st_mode & S_IXUSR)
|
if(st.st_size && st.st_mode & S_IXUSR)
|
||||||
{
|
{
|
||||||
estatus = True;
|
estatus = True;
|
||||||
system(status_path);
|
system(status_path);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user