]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: when we can't fit in all partitions explain how large the image would have...
authorLennart Poettering <lennart@poettering.net>
Fri, 19 Mar 2021 19:31:29 +0000 (20:31 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 19 Apr 2021 21:16:02 +0000 (23:16 +0200)
src/partition/repart.c

index 081f95ebe70bd96c13511b47a3fd7e0e567ef90b..1ee5eaa25e840261019514ecfecec376a3df68df 100644 (file)
@@ -4167,8 +4167,6 @@ static int determine_auto_size(Context *c) {
         Partition *p;
 
         assert_se(c);
-        assert_se(arg_size == UINT64_MAX);
-        assert_se(arg_size_auto);
 
         LIST_FOREACH(partitions, p, c->partitions) {
                 uint64_t m;
@@ -4352,9 +4350,13 @@ static int run(int argc, char *argv[]) {
                 if (context_allocate_partitions(context))
                         break; /* Success! */
 
-                if (!context_drop_one_priority(context))
-                        return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
-                                               "Can't fit requested partitions into free space, refusing.");
+                if (!context_drop_one_priority(context)) {
+                        r = log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
+                                            "Can't fit requested partitions into free space, refusing.");
+
+                        determine_auto_size(context);
+                        return r;
+                }
         }
 
         /* Now assign free space according to the weight logic */