Tell the user how much data will be written beforehand

This commit is contained in:
Imbus 2026-02-07 18:24:32 +01:00
parent a1556ca383
commit 53239324ef

View file

@ -261,8 +261,14 @@ int main(int argc, char *argv[]) {
}
close(fd);
wjob.total_bytes = file_stat.st_size;
assert(file_stat.st_size >= 0);
if (!wjob.verify_only)
printf("Writing %s to %s\n", wjob.filename, wjob.dev_name);
printf("Writing \"%s\" (%.1f MiB) to \"%s\"\n",
basename(wjob.filename),
BYTES_TO_MIB(wjob.total_bytes),
wjob.dev_name);
if (ask_permission && !wjob.verify_only) {
printf("Is this okay? (y/N): ");
@ -281,9 +287,6 @@ int main(int argc, char *argv[]) {
wjob.bufsize = BLOCKSIZE;
wjob.block_size = BLOCKSIZE;
wjob.total_bytes = file_stat.st_size;
assert(file_stat.st_size >= 0);
perform_write(&wjob);
if (wjob.buffer)