Fix re-review: remove __thread from io_ssl (breaks -m), strtol port parsing, --ca warning

This commit is contained in:
2026-07-16 17:08:15 +02:00
parent 7a314b8391
commit df85509812
2 changed files with 10 additions and 5 deletions
+9 -4
View File
@@ -195,7 +195,13 @@ int main(int argc, char *argv[]) {
} else if (strcmp(argv[i], "--ca") == 0 && i + 1 < argc) {
tls_ca = argv[++i];
} else if (strcmp(argv[i], "-p") == 0 && i + 1 < argc) {
port = atoi(argv[++i]);
char *end;
long p = strtol(argv[++i], &end, 10);
if (*end || p <= 0 || p > 65535) {
fprintf(stderr, "Error: invalid port '%s' (must be 1-65535)\n", argv[i]);
return 1;
}
port = (int)p;
} else if (argv[i][0] == '-') {
fprintf(stderr, "Unknown option: %s\n", argv[i]);
print_server_usage();
@@ -203,9 +209,8 @@ int main(int argc, char *argv[]) {
}
}
if (port < 1 || port > 65535) {
fprintf(stderr, "Error: port must be between 1 and 65535\n");
return 1;
if (tls_ca && !use_tls) {
log_message(LOG_LEVEL_WARNING, "--ca has no effect without --tls");
}
signal(SIGINT, cleanup);
+1 -1
View File
@@ -8,7 +8,7 @@
static __thread int io_read_fd = -1;
static __thread int io_write_fd = -1;
static __thread SSL *io_ssl = NULL;
static SSL *io_ssl = NULL;
void io_set_fds(int read_fd, int write_fd) {
io_read_fd = read_fd;