dissect: make returning of DissectedImage object optional
Sometimes, we just want to validate if an image (or image policy) works, hence let's make the returning optional.
This commit is contained in:
@@ -1535,7 +1535,6 @@ int dissect_image_file(
|
||||
int r;
|
||||
|
||||
assert(path);
|
||||
assert(ret);
|
||||
|
||||
fd = open(path, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
|
||||
if (fd < 0)
|
||||
@@ -1557,7 +1556,8 @@ int dissect_image_file(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
*ret = TAKE_PTR(m);
|
||||
if (ret)
|
||||
*ret = TAKE_PTR(m);
|
||||
return 0;
|
||||
#else
|
||||
return -EOPNOTSUPP;
|
||||
@@ -3514,7 +3514,6 @@ int dissect_loop_device(
|
||||
int r;
|
||||
|
||||
assert(loop);
|
||||
assert(ret);
|
||||
|
||||
r = dissected_image_new(loop->backing_file ?: loop->node, &m);
|
||||
if (r < 0)
|
||||
@@ -3527,7 +3526,9 @@ int dissect_loop_device(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
*ret = TAKE_PTR(m);
|
||||
if (ret)
|
||||
*ret = TAKE_PTR(m);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
Reference in New Issue
Block a user