X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=1b30cae1b02dc1f5d58366267e4979092b7fb23b;hp=43f0fd51b2c7abedf4aff7f968de876f4ee781b7;hb=33fe200b521b19a089d39aca247bb78432e02e6d;hpb=c13be8d620372a55f5867cafd6ad4277ad77790c diff --git a/dwm.c b/dwm.c index 43f0fd5..1b30cae 100644 --- a/dwm.c +++ b/dwm.c @@ -207,7 +207,7 @@ static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); static void showhide(Client *c); -static void sigchld(int signal); +static void sigchld(int unused); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); @@ -1428,6 +1428,10 @@ setup(void) { int w; XSetWindowAttributes wa; + /* clean up any zombies immediately */ + signal(SIGCHLD, sigchld); + sigchld(0); + /* init screen */ screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); @@ -1496,13 +1500,13 @@ showhide(Client *c) { void -sigchld(int signal) { +sigchld(int unused) { while(0 < waitpid(-1, NULL, WNOHANG)); + signal(SIGCHLD, sigchld); } void spawn(const Arg *arg) { - signal(SIGCHLD, sigchld); if(fork() == 0) { if(dpy) close(ConnectionNumber(dpy)); @@ -1683,11 +1687,12 @@ updatebarpos(Monitor *m) { void updategeom(void) { - int i, n = 1, nn; + int i, n = 1; Client *c; Monitor *newmons = NULL, *m = NULL, *tm; #ifdef XINERAMA + int nn; XineramaScreenInfo *info = NULL; if(XineramaIsActive(dpy)) @@ -1696,7 +1701,7 @@ updategeom(void) { if(info[i - 1].x_org == info[i].x_org && info[i - 1].y_org == info[i].y_org && info[i - 1].width == info[i].width && info[i - 1].height == info[i].height) --nn; - n = nn; /* we only consider unique geometrys as separate screens */ + n = nn; /* we only consider unique geometries as separate screens */ #endif /* XINERAMA */ /* allocate monitor(s) for the new geometry setup */ for(i = 0; i < n; i++) {