summaryrefslogtreecommitdiff
path: root/parted/ui.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-01-14 18:50:54 +0100
committerJim Meyering <meyering@redhat.com>2008-01-14 19:05:46 +0100
commit05942c0b1c7ae91a86ef3561124705d295d5dd24 (patch)
tree00a24181a10e2a80d16e1cd35cf50b2332d83dfe /parted/ui.c
parentd1d48d3af403ae623b0aee2d2068f980c86105fd (diff)
downloadparted-05942c0b1c7ae91a86ef3561124705d295d5dd24.tar.gz
#ifdef function definitions to match uses, to avoid compiler warnings.
* parted/ui.c (mask_signal, s_sigint_handler, s_sigsegv_handler) (s_sigfpe_handler): Signed-off-by: Jim Meyering <meyering@redhat.com>
Diffstat (limited to 'parted/ui.c')
-rw-r--r--parted/ui.c79
1 files changed, 41 insertions, 38 deletions
diff --git a/parted/ui.c b/parted/ui.c
index a53643f..370c2be 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -1,6 +1,6 @@
/*
parted - a frontend to libparted
- Copyright (C) 1999, 2000, 2001, 2002, 2006, 2007
+ Copyright (C) 1999, 2000, 2001, 2002, 2006, 2007, 2008
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -297,16 +297,6 @@ _dump_history (void)
#endif /* HAVE_LIBREADLINE */
-static void
-mask_signal()
-{
- sigset_t curr;
- sigset_t prev;
-
- sigfillset(&curr);
- sigprocmask(SIG_SETMASK, &curr, &prev);
-}
-
/* Resets the environment by jumping to the initial state
* saved during ui intitialisation.
* Pass 1 as the parameter if you want to quit parted,
@@ -339,15 +329,6 @@ sa_sigint_handler (int signum, siginfo_t* info, void *ucontext)
reset_env (0);
}
-/* Signal handler for SIGINT using 'signal'. */
-static void
-s_sigint_handler (int signum)
-{
- signal (SIGINT, &s_sigint_handler);
- mask_signal ();
- sa_sigint_handler (signum, NULL, NULL);
-}
-
/* Signal handler for SIGSEGV using 'sigaction'. */
static void
sa_sigsegv_handler (int signum, siginfo_t* info, void* ucontext)
@@ -383,15 +364,6 @@ sa_sigsegv_handler (int signum, siginfo_t* info, void* ucontext)
abort ();
}
-/* Signal handler for SIGSEGV using 'signal'. */
-static void
-s_sigsegv_handler (int signum)
-{
- signal (SIGSEGV, &s_sigsegv_handler);
- mask_signal ();
- sa_sigsegv_handler (signum, NULL, NULL);
-}
-
/* Signal handler for SIGFPE using 'sigaction'. */
static void
sa_sigfpe_handler (int signum, siginfo_t* info, void* ucontext)
@@ -456,15 +428,6 @@ sa_sigfpe_handler (int signum, siginfo_t* info, void* ucontext)
abort ();
}
-/* Signal handler for SIGFPE using 'signal'. */
-static void
-s_sigfpe_handler (int signum)
-{
- signal (SIGFPE, &s_sigfpe_handler);
- mask_signal ();
- sa_sigfpe_handler (signum, NULL, NULL);
-}
-
/* Signal handler for SIGILL using 'sigaction'. */
static void
sa_sigill_handler (int signum, siginfo_t* info, void* ucontext)
@@ -528,6 +491,27 @@ sa_sigill_handler (int signum, siginfo_t* info, void* ucontext)
abort ();
}
+#ifndef SA_SIGINFO
+
+static void
+mask_signal()
+{
+ sigset_t curr;
+ sigset_t prev;
+
+ sigfillset(&curr);
+ sigprocmask(SIG_SETMASK, &curr, &prev);
+}
+
+/* Signal handler for SIGINT using 'signal'. */
+static void
+s_sigint_handler (int signum)
+{
+ signal (SIGINT, &s_sigint_handler);
+ mask_signal ();
+ sa_sigint_handler (signum, NULL, NULL);
+}
+
/* Signal handler for SIGILL using 'signal'. */
static void
s_sigill_handler (int signum)
@@ -537,6 +521,25 @@ s_sigill_handler (int signum)
sa_sigill_handler (signum, NULL, NULL);
}
+/* Signal handler for SIGSEGV using 'signal'. */
+static void
+s_sigsegv_handler (int signum)
+{
+ signal (SIGSEGV, &s_sigsegv_handler);
+ mask_signal ();
+ sa_sigsegv_handler (signum, NULL, NULL);
+}
+
+/* Signal handler for SIGFPE using 'signal'. */
+static void
+s_sigfpe_handler (int signum)
+{
+ signal (SIGFPE, &s_sigfpe_handler);
+ mask_signal ();
+ sa_sigfpe_handler (signum, NULL, NULL);
+}
+#endif
+
static char*
_readline (const char* prompt, const StrList* possibilities)
{