summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-06-15 20:13:23 +0200
committerLennart Poettering <lennart@poettering.net>2015-06-15 20:13:23 +0200
commit72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9 (patch)
tree09bd6f8db366a0a611de79dc08d88902d10f6a75 /src/import
parenta4c8a5995102144225439c0077bbda5325761986 (diff)
everywhere: port everything to sigprocmask_many() and friends
This ports a lot of manual code over to sigprocmask_many() and friends. Also, we now consistly check for sigprocmask() failures with assert_se(), since the call cannot realistically fail unless there's a programming error. Also encloses a few sd_event_add_signal() calls with (void) when we ignore the return values for it knowingly.
Diffstat (limited to 'src/import')
-rw-r--r--src/import/export.c12
-rw-r--r--src/import/import.c12
-rw-r--r--src/import/importd.c2
-rw-r--r--src/import/pull.c18
4 files changed, 22 insertions, 22 deletions
diff --git a/src/import/export.c b/src/import/export.c
index e563bee96e..ec7dbe210a 100644
--- a/src/import/export.c
+++ b/src/import/export.c
@@ -118,9 +118,9 @@ static int export_tar(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to allocate event loop: %m");
- assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
- sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
- sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
+ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
+ (void) sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
+ (void) sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
r = tar_export_new(&export, event, on_tar_finished, event);
if (r < 0)
@@ -197,9 +197,9 @@ static int export_raw(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to allocate event loop: %m");
- assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
- sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
- sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
+ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
+ (void) sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
+ (void) sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
r = raw_export_new(&export, event, on_raw_finished, event);
if (r < 0)
diff --git a/src/import/import.c b/src/import/import.c
index 3091ed1c45..b7772390e9 100644
--- a/src/import/import.c
+++ b/src/import/import.c
@@ -116,9 +116,9 @@ static int import_tar(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to allocate event loop: %m");
- assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
- sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
- sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
+ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
+ (void) sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
+ (void) sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
r = tar_import_new(&import, event, arg_image_root, on_tar_finished, event);
if (r < 0)
@@ -211,9 +211,9 @@ static int import_raw(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to allocate event loop: %m");
- assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
- sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
- sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
+ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
+ (void) sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
+ (void) sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
r = raw_import_new(&import, event, arg_image_root, on_raw_finished, event);
if (r < 0)
diff --git a/src/import/importd.c b/src/import/importd.c
index 05a619ac0c..03aede6016 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -1301,7 +1301,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- assert_se(sigprocmask_many(SIG_BLOCK, SIGCHLD, -1) >= 0);
+ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, -1) >= 0);
r = manager_new(&m);
if (r < 0) {
diff --git a/src/import/pull.c b/src/import/pull.c
index 03fe3dcaf4..ca33d2f3fa 100644
--- a/src/import/pull.c
+++ b/src/import/pull.c
@@ -109,9 +109,9 @@ static int pull_tar(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to allocate event loop: %m");
- assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
- sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
- sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
+ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
+ (void) sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
+ (void) sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
r = tar_pull_new(&pull, event, arg_image_root, on_tar_finished, event);
if (r < 0)
@@ -195,9 +195,9 @@ static int pull_raw(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to allocate event loop: %m");
- assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
- sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
- sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
+ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
+ (void) sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
+ (void) sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
r = raw_pull_new(&pull, event, arg_image_root, on_raw_finished, event);
if (r < 0)
@@ -303,9 +303,9 @@ static int pull_dkr(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to allocate event loop: %m");
- assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
- sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
- sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
+ assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
+ (void) sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
+ (void) sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
r = dkr_pull_new(&pull, event, arg_dkr_index_url, arg_image_root, on_dkr_finished, event);
if (r < 0)