Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fvbe.git;a=commitdiff;h=38f0cbd2d9386e7eda2cc45170c19e76931fb836

commit 38f0cbd2d9386e7eda2cc45170c19e76931fb836
Author: James Buren <[email protected]>
Date:   Sun Oct 20 14:56:54 2013 -0500

ui_newt: prevent sigwinch from interrupting system calls
This signal is used solely to signal a change in the terminal window dimensions.
Why interrupt system calls for this? AFAIK, this should only effect screen 
drawing.
So it shouldn't break anything to not interrupt system calls for this signal.
This fixes a bug where terminal window resizes would crash fork() and perhaps
other system calls.

diff --git a/src/local.h b/src/local.h
index b4d7e06..5686ce9 100644
--- a/src/local.h
+++ b/src/local.h
@@ -42,6 +42,7 @@
#include <locale.h>
#include <time.h>
#include <dirent.h>
+#include <signal.h>
#include <libgen.h>
#include <search.h>
#include <blkid.h>
diff --git a/src/ui_newt.c b/src/ui_newt.c
index 1c06fc5..b930143 100644
--- a/src/ui_newt.c
+++ b/src/ui_newt.c
@@ -1790,6 +1790,14 @@ extern int ui_main(int argc,char **argv)
return code;
}

+  // Needed to keep SIGWINCH from screwing up system calls.
+  if(siginterrupt(SIGWINCH,false) == -1)
+  {
+    eprintf("Failed to stop SIGWINCH from interrupting system calls.\n");
+    newtFinished();
+    return code;
+  }
+
newtGetScreenSize(&w,&h);

if(w < 80 || h < 24)
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to