Skip to content

Commit

Permalink
Updater: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
endrift committed Oct 12, 2022
1 parent ded409f commit 16bcdd0
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/feature/updater-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ int main(int argc, char* argv[]) {

mCoreConfigInit(&config, "updater");
if (!mCoreConfigLoad(&config)) {
fputs("Failed to load config", logfile);
fputs("Failed to load config\n", logfile);
} else if (!mUpdateGetArchivePath(&config, updateArchive, sizeof(updateArchive)) || !(root = mUpdateGetRoot(&config))) {
fputs("No pending update found", logfile);
fputs("No pending update found\n", logfile);
} else if (access(root, W_OK)) {
fputs("Cannot write to update path", logfile);
fputs("Cannot write to update path\n", logfile);
} else {
#ifdef __APPLE__
char subdir[PATH_MAX];
Expand Down Expand Up @@ -166,7 +166,6 @@ int main(int argc, char* argv[]) {
}
off_t diff = devend - devinfo - 1;
memcpy(devpath, &devinfo[1], diff);
fputs(devpath, logfile);
break;
}
int retstat;
Expand All @@ -183,11 +182,11 @@ int main(int argc, char* argv[]) {
archive = VDirOpenArchive(updateArchive);
}
if (archive) {
fputs("Extracting update", logfile);
fputs("Extracting update\n", logfile);
if (extractArchive(archive, root, prefix)) {
ok = 0;
} else {
fputs("An error occurred", logfile);
fputs("An error occurred\n", logfile);
}
archive->close(archive);
unlink(updateArchive);
Expand Down Expand Up @@ -224,10 +223,10 @@ int main(int argc, char* argv[]) {
close(infd);
}
if (ok == 2) {
fputs("Cannot move update over old file", logfile);
fputs("Cannot move update over old file\n", logfile);
}
} else {
fputs("Cannot move update over old file", logfile);
fputs("Cannot move update over old file\n", logfile);
}
} else {
ok = 0;
Expand All @@ -238,7 +237,7 @@ int main(int argc, char* argv[]) {
}
#endif
else {
fputs("Cannot open update archive", logfile);
fputs("Cannot open update archive\n", logfile);
}
if (ok == 0) {
fputs("Complete", logfile);
Expand Down

0 comments on commit 16bcdd0

Please sign in to comment.