diff --git a/src/partition/repart.c b/src/partition/repart.c index 473c83a6ac..41eb1d771a 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -6264,10 +6264,10 @@ static int context_minimize(Context *context) { d = loop_device_unref(d); /* Erase the previous filesystem first. */ - if (ftruncate(fd, 0)) + if (ftruncate(fd, 0) < 0) return log_error_errno(errno, "Failed to erase temporary file: %m"); - if (ftruncate(fd, fsz)) + if (ftruncate(fd, fsz) < 0) return log_error_errno(errno, "Failed to truncate temporary file to %s: %m", FORMAT_BYTES(fsz)); if (arg_offline <= 0) {