Bläddra i källkod

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

Martin Duquesnoy 14 år sedan
förälder
incheckning
8362a4ab68
2 ändrade filer med 4 tillägg och 3 borttagningar
  1. 0 1
      src/infobar.c
  2. 4 2
      src/init.c

+ 0 - 1
src/infobar.c

@@ -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;
                }

+ 4 - 2
src/init.c

@@ -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);