Skip to content

Commit 462c733

Browse files
shradhagupta6root
andauthored
Fix: exit on failures during defrag operation and add verbose logging (#23)
Co-authored-by: root <root@DESKTOP-UT47VEB>
1 parent e7388d4 commit 462c733

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

hibernation-setup-tool.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -933,18 +933,6 @@ static bool try_vspawn_and_wait(const char *program, int n_args, va_list ap)
933933
return true;
934934
}
935935

936-
static bool try_spawn_and_wait(const char *program, int n_args, ...)
937-
{
938-
va_list ap;
939-
bool spawned;
940-
941-
va_start(ap, n_args);
942-
spawned = try_vspawn_and_wait(program, n_args, ap);
943-
va_end(ap);
944-
945-
return spawned;
946-
}
947-
948936
static void spawn_and_wait(const char *program, int n_args, ...)
949937
{
950938
va_list ap;
@@ -964,7 +952,7 @@ static void perform_fs_specific_checks(const char *path)
964952
While it is good to have optimization, not ideal to have performance hit on the tool */
965953

966954
if (is_file_on_fs(path, EXT4_SUPER_MAGIC) && is_exec_in_path("e4defrag")) {
967-
try_spawn_and_wait("e4defrag", 1, path);
955+
spawn_and_wait("e4defrag", 2, "-v", path);
968956
return;
969957
}
970958

@@ -979,7 +967,7 @@ static void perform_fs_specific_checks(const char *path)
979967
log_fatal("Swap files are not supported on Btrfs running on kernel %s", utsbuf.release);
980968

981969
if (is_exec_in_path("btrfs"))
982-
try_spawn_and_wait("btrfs", 3, "filesystem", "defragment", path);
970+
spawn_and_wait("btrfs", 3, "filesystem", "defragment", path);
983971
return;
984972
}
985973
}

0 commit comments

Comments
 (0)