On Wed, Nov 24, 2010 at 10:26:08AM -0300, Davidlohr Bueso wrote: > On Tue, 2010-11-23 at 21:49 +0100, Karel Zak wrote: > > On Mon, Nov 15, 2010 at 08:52:46AM -0300, Davidlohr Bueso wrote: > > > +static void > > > +sighand(int sig) { > > > + if (sig == SIGINT) > > > + is_mainmenu() ? _exit(EXIT_SUCCESS) : main_menu(); > > ^^^^^^^^^^ > > > +} > > > > So you moved whole fdisk to signal handler, really? > > Isn't that the only way to catch signals? The ideal way is to set a global variable in your signal handler and nothing other. In the rest of the program you can check the variable (for example when a syscall ends with EINTR) and then evaluate the situation (restart the syscall, call exit(), return to main loop, or so...). Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html