mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
signals: Add init_signals.
This commit is contained in:
parent
2eed136f0f
commit
09064cc2db
@ -33,10 +33,6 @@
|
||||
|
||||
static char _lock_dir[PATH_MAX];
|
||||
|
||||
static sig_t _oldhandler;
|
||||
static sigset_t _fullsigset, _intsigset;
|
||||
static volatile sig_atomic_t _handler_installed;
|
||||
|
||||
static void _fin_file_locking(void)
|
||||
{
|
||||
release_flocks(1);
|
||||
@ -163,17 +159,8 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd,
|
||||
if ((access(_lock_dir, R_OK | W_OK | X_OK) == -1) && (errno == EROFS))
|
||||
return 0;
|
||||
|
||||
if (sigfillset(&_intsigset) || sigfillset(&_fullsigset)) {
|
||||
log_sys_error_suppress(suppress_messages, "sigfillset",
|
||||
"init_file_locking");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sigdelset(&_intsigset, SIGINT)) {
|
||||
log_sys_error_suppress(suppress_messages, "sigdelset",
|
||||
"init_file_locking");
|
||||
return 0;
|
||||
}
|
||||
if (!init_signals(suppress_messages))
|
||||
return_0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -62,6 +62,23 @@ void install_ctrl_c_handler(void)
|
||||
siginterrupt(SIGINT, 1);
|
||||
}
|
||||
|
||||
int init_signals(int suppress_messages)
|
||||
{
|
||||
if (sigfillset(&_intsigset) || sigfillset(&_fullsigset)) {
|
||||
log_sys_error_suppress(suppress_messages, "sigfillset",
|
||||
"init_signals");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sigdelset(&_intsigset, SIGINT)) {
|
||||
log_sys_error_suppress(suppress_messages, "sigdelset",
|
||||
"init_signals");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _catch_sigint(int unused __attribute__((unused)))
|
||||
{
|
||||
_sigint_caught = 1;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
void remove_ctrl_c_handler(void);
|
||||
void install_ctrl_c_handler(void);
|
||||
int init_signals(int suppress_messages);
|
||||
|
||||
void sigint_allow(void);
|
||||
int sigint_caught(void);
|
||||
|
Loading…
Reference in New Issue
Block a user