aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-12-19 18:16:41 +0100
committerLennart Poettering <lennart@poettering.net>2018-12-19 23:27:47 +0100
commitf70e7f70c9c5b640ca5b097d64da26e4c5d3fac9 (patch)
tree95e5045bed8dc1a9e5ac8b2ad07338d5daf3e158
parentgpt-auto-generator: don't wait for udev (diff)
downloadsystemd-f70e7f70c9c5b640ca5b097d64da26e4c5d3fac9.tar.gz
systemd-f70e7f70c9c5b640ca5b097d64da26e4c5d3fac9.tar.bz2
systemd-f70e7f70c9c5b640ca5b097d64da26e4c5d3fac9.zip
dissect: add some assert()s
-rw-r--r--src/shared/dissect-image.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index 551a67b6c..3a46faf76 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -102,6 +102,8 @@ not_found:
static bool device_is_mmc_special_partition(sd_device *d) {
const char *sysname;
+ assert(d);
+
if (sd_device_get_sysname(d, &sysname) < 0)
return false;
@@ -112,6 +114,8 @@ static bool device_is_mmc_special_partition(sd_device *d) {
static bool device_is_block(sd_device *d) {
const char *ss;
+ assert(d);
+
if (sd_device_get_subsystem(d, &ss) < 0)
return false;
@@ -122,6 +126,9 @@ static int enumerator_for_parent(sd_device *d, sd_device_enumerator **ret) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
int r;
+ assert(d);
+ assert(ret);
+
r = sd_device_enumerator_new(&e);
if (r < 0)
return r;
@@ -153,6 +160,10 @@ static int wait_for_partitions_to_appear(
unsigned n;
int r;
+ assert(fd >= 0);
+ assert(d);
+ assert(ret_enumerator);
+
r = enumerator_for_parent(d, &e);
if (r < 0)
return r;
@@ -231,6 +242,10 @@ static int loop_wait_for_partitions_to_appear(
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
int r;
+ assert(fd >= 0);
+ assert(d);
+ assert(ret_enumerator);
+
log_debug("Waiting for device (parent + %d partitions) to appear...", num_partitions);
if (!FLAGS_SET(flags, DISSECT_IMAGE_NO_UDEV)) {