Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 155274 Details for
Bug 180286
LVM should still capture signals when prompting the user
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
lvm2-prompt-sigint.diff
lvm2-prompt-sigint.diff (text/plain), 2.58 KB, created by
Petr Rockai
on 2007-05-23 16:57:21 UTC
(
hide
)
Description:
lvm2-prompt-sigint.diff
Filename:
MIME Type:
Creator:
Petr Rockai
Created:
2007-05-23 16:57:21 UTC
Size:
2.58 KB
patch
obsolete
>Index: lib/locking/locking.c >=================================================================== >RCS file: /cvs/lvm2/LVM2/lib/locking/locking.c,v >retrieving revision 1.35 >diff -u -p -r1.35 locking.c >--- lib/locking/locking.c 30 Nov 2006 23:11:41 -0000 1.35 >+++ lib/locking/locking.c 23 May 2007 16:34:44 -0000 >@@ -34,6 +34,63 @@ static int _vg_lock_count = 0; /* Numbe > static int _vg_write_lock_held = 0; /* VG write lock held? */ > static int _signals_blocked = 0; > >+static volatile sig_atomic_t _sigint_caught; >+static volatile sig_atomic_t _handler_installed; >+static struct sigaction _oldhandler; >+static int _oldmasked; >+ >+int sigint_check_exit() { >+ if (_sigint_caught) >+ exit(1); >+} >+ >+static void _catch_sigint(int unused __attribute__((unused))) >+{ >+ _sigint_caught = 1; >+} >+ >+void sigint_allow() >+{ >+ struct sigaction handler; >+ sigset_t sigs; >+ >+ /* grab old sigaction for SIGINT; shall not fail */ >+ sigaction(SIGINT, NULL, &handler); >+ handler.sa_flags &= ~SA_RESTART; /* clear restart flag */ >+ handler.sa_handler = _catch_sigint; >+ >+ _handler_installed = 1; >+ _sigint_caught = 0; >+ >+ /* override the signal handler; shall not fail */ >+ sigaction(SIGINT, &handler, &_oldhandler); >+ >+ /* unmask SIGINT, remember to mask it again on restore */ >+ sigprocmask(0, NULL, &sigs); >+ if ((_oldmasked = sigismember(&sigs, SIGINT))) { >+ sigdelset(&sigs, SIGINT); >+ sigprocmask(SIG_SETMASK, &sigs, NULL); >+ } >+} >+ >+void sigint_restore() >+{ >+ if (!_handler_installed) >+ return; >+ >+ _handler_installed = 0; >+ _sigint_caught = 0; >+ >+ if (_oldmasked) { >+ sigset_t sigs; >+ sigprocmask(0, NULL, &sigs); >+ sigaddset(&sigs, SIGINT); >+ sigprocmask(SIG_SETMASK, &sigs, NULL); >+ } >+ >+ sigaction(SIGINT, &_oldhandler, NULL); >+} >+ > static void _block_signals(int flags __attribute((unused))) > { > sigset_t set; >Index: tools/lvmcmdline.c >=================================================================== >RCS file: /cvs/lvm2/LVM2/tools/lvmcmdline.c,v >retrieving revision 1.42 >diff -u -p -r1.42 lvmcmdline.c >--- tools/lvmcmdline.c 26 Apr 2007 16:44:59 -0000 1.42 >+++ tools/lvmcmdline.c 23 May 2007 16:34:44 -0000 >@@ -373,6 +373,7 @@ char yes_no_prompt(const char *prompt, . > int c = 0, ret = 0; > va_list ap; > >+ sigint_allow(); > do { > if (c == '\n' || !c) { > va_start(ap, prompt); >@@ -380,6 +381,7 @@ char yes_no_prompt(const char *prompt, . > va_end(ap); > } > >+ sigint_check_exit(); > if ((c = getchar()) == EOF) { > ret = 'n'; > break; >@@ -390,6 +392,9 @@ char yes_no_prompt(const char *prompt, . > ret = c; > } while (!ret || c != '\n'); > >+ sigint_check_exit(); >+ sigint_restore(); >+ > if (c != '\n') > printf("\n"); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 180286
: 155274