summaryrefslogtreecommitdiff
path: root/cmd/snap-confine
diff options
authorZygmunt Krynicki <me@zygoon.pl>2019-06-25 15:36:38 +0200
committerZygmunt Krynicki <me@zygoon.pl>2019-06-26 16:41:40 +0200
commit48e05f4e119a6a88ffea03bf9ebf17e9f9dd90dc (patch)
treec9a9c3613ab1a79854b7ff3805d77058848b2e11 /cmd/snap-confine
parent1ec6c6bb6d6b110debab5fa78d4d660fee1e6dce (diff)
cmd/libsnap: add error handling to sc_infofile_query
Using error handling we can more easily write better coverage of test as the classic approach of exiting the program on any error requires more boiler-plate in glib tests. Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
Diffstat (limited to 'cmd/snap-confine')
-rw-r--r--cmd/snap-confine/ns-support.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/snap-confine/ns-support.c b/cmd/snap-confine/ns-support.c
index a5d351adb2..4efd3ae1f2 100644
--- a/cmd/snap-confine/ns-support.c
+++ b/cmd/snap-confine/ns-support.c
@@ -324,7 +324,11 @@ static bool is_base_transition(const sc_invocation * inv)
}
char *base_snap_name SC_CLEANUP(sc_cleanup_string) = NULL;
- sc_infofile_query(stream, "base-snap-name", &base_snap_name, NULL);
+ sc_error *err = NULL;
+ if (sc_infofile_query
+ (stream, &err, "base-snap-name", &base_snap_name, NULL) < 0) {
+ sc_die_on_error(err);
+ }
if (base_snap_name == NULL) {
// If the info file doesn't record the name of the base snap then,