summaryrefslogtreecommitdiff
path: root/source4/scripting/bin/samba_upgradeprovision
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-09-25 20:49:22 +0200
committerJelmer Vernooij <jelmer@samba.org>2012-09-25 20:59:09 +0200
commitfa332b71dc71d23f1475ed6c25a6376934ab652a (patch)
tree1d260e1a86c56bd027ce2c6f2d74ade32ac9bb16 /source4/scripting/bin/samba_upgradeprovision
parentc034ff7b1516f827ab4538613ec98daa170d9f25 (diff)
downloadsamba-fa332b71dc71d23f1475ed6c25a6376934ab652a.tar.gz
samba-fa332b71dc71d23f1475ed6c25a6376934ab652a.tar.bz2
samba-fa332b71dc71d23f1475ed6c25a6376934ab652a.zip
s4-python: Override SIGINT handler in scripts only.
Override the SIGINT handler in a few select cases only, rather than doing so in one of the samba Python modules. I've done this where it matters most; we can add this code to other scripts too if necessary. This means that importing the 'samba' module from a third party application does not have side-effects on the state of the signal handlers. Bug: https://bugzilla.samba.org/show_bug.cgi?id=9068
Diffstat (limited to 'source4/scripting/bin/samba_upgradeprovision')
-rwxr-xr-xsource4/scripting/bin/samba_upgradeprovision6
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/scripting/bin/samba_upgradeprovision b/source4/scripting/bin/samba_upgradeprovision
index 344d7f56c2..54ffbeab1e 100755
--- a/source4/scripting/bin/samba_upgradeprovision
+++ b/source4/scripting/bin/samba_upgradeprovision
@@ -66,6 +66,12 @@ from samba.upgradehelpers import (dn_sort, get_paths, newprovision,
print_provision_ranges)
from samba.xattr import copytree_with_xattrs
+# make sure the script dies immediately when hitting control-C,
+# rather than raising KeyboardInterrupt. As we do all database
+# operations using transactions, this is safe.
+import signal
+signal.signal(signal.SIGINT, signal.SIG_DFL)
+
replace=2**FLAG_MOD_REPLACE
add=2**FLAG_MOD_ADD
delete=2**FLAG_MOD_DELETE