mirror of
https://github.com/yrutschle/sslh.git
synced 2026-12-06 03:55:10 +03:00
fix: close err_log after writing success message in main()
err_log was fclose()'d before the "Successfully generated all targets" fprintf(), resulting in a write-after-close that corrupted glibc's internal stdio buffers and triggered an abort() via SIGABRT on every systemd-invoked run regardless of whether /etc/sslh/ exists. Fix by moving the success fprintf() above the fclose() call.
This commit is contained in:
1 parent
dc70cc0d3b
commit
6c0dc269c7
1 file changed
+3
-3
@@ -307,12 +307,12 @@ int main(int argc, char *argv[]) {
|
||||
err_log = stderr;
|
||||
}
|
||||
const int r = gen_sslh_config(systemd_invoked ? argv[1] : "");
|
||||
if (systemd_invoked) {
|
||||
fclose(err_log);
|
||||
}
|
||||
if (!r) {
|
||||
fprintf(err_log, "systemd-sslh-generator: Successfully generated all targets.\n");
|
||||
}
|
||||
if (systemd_invoked) {
|
||||
fclose(err_log);
|
||||
}
|
||||
return r < 0 ? -1 : 0;
|
||||
} else {
|
||||
printf("This program takes three or no arguments.\n");
|
||||
|
||||
Reference in new issue
Block a user