Skip to content

Commit 058ff85

Browse files
committed
Print update/verify status message after fd leak check
In case there are file descriptor leaks, those issues would be printed after the status message, but it should be the other way around: the last printed message should reflect the result of the action. Signed-off-by: Patrick McCarty <[email protected]>
1 parent 9b9bffd commit 058ff85

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/update.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,6 @@ int main_update()
385385
printf("Update was applied.\n");
386386
}
387387

388-
if ((current_version < server_version) && (ret == 0)) {
389-
printf("Update successful. System updated from version %d to version %d\n",
390-
current_version, server_version);
391-
} else if (ret == 0) {
392-
printf("Update complete. System already up-to-date at version %d\n", current_version);
393-
}
394-
395388
delete_motd();
396389

397390
/* Run any scripts that are needed to complete update */
@@ -407,12 +400,15 @@ int main_update()
407400
swupd_curl_cleanup();
408401
free_subscriptions();
409402
free_globals();
410-
411-
printf("Update exiting.\n");
412-
413403
v_lockfile(lock_fd);
414-
415404
dump_file_descriptor_leaks();
416405

406+
if ((current_version < server_version) && (ret == 0)) {
407+
printf("Update successful. System updated from version %d to version %d\n",
408+
current_version, server_version);
409+
} else if (ret == 0) {
410+
printf("Update complete. System already up-to-date at version %d\n", current_version);
411+
}
412+
417413
return ret;
418414
}

src/verify.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,13 @@ int verify_main(int argc, char **argv)
791791
/* this concludes the critical section, after this point it's clean up time, the disk content is finished and final */
792792

793793
clean_and_exit:
794+
swupd_curl_cleanup();
795+
free_subscriptions();
796+
free_manifest(official_manifest);
797+
v_lockfile(lock_fd);
798+
dump_file_descriptor_leaks();
799+
free_globals();
800+
794801
if (ret == EXIT_SUCCESS) {
795802
if (cmdline_option_fix || cmdline_option_install) {
796803
printf("Fix successful\n");
@@ -806,12 +813,6 @@ int verify_main(int argc, char **argv)
806813
printf("Error: Verify did not fully succeed\n");
807814
}
808815
}
809-
swupd_curl_cleanup();
810-
free_subscriptions();
811-
free_manifest(official_manifest);
812816

813-
v_lockfile(lock_fd);
814-
dump_file_descriptor_leaks();
815-
free_globals();
816817
return ret;
817818
}

0 commit comments

Comments
 (0)