Fix re-review: remove __thread from io_ssl (breaks -m), strtol port parsing, --ca warning
This commit is contained in:
+9
-4
@@ -161,7 +161,13 @@ int main(int argc, char *argv[]) {
|
|||||||
} else if (strcmp(argv[i], "--ca") == 0 && i + 1 < argc) {
|
} else if (strcmp(argv[i], "--ca") == 0 && i + 1 < argc) {
|
||||||
tls_ca = argv[++i];
|
tls_ca = argv[++i];
|
||||||
} else if (strcmp(argv[i], "-p") == 0 && i + 1 < argc) {
|
} 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] == '-') {
|
} else if (argv[i][0] == '-') {
|
||||||
fprintf(stderr, "Unknown option: %s\n", argv[i]);
|
fprintf(stderr, "Unknown option: %s\n", argv[i]);
|
||||||
print_server_usage();
|
print_server_usage();
|
||||||
@@ -169,9 +175,8 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port < 1 || port > 65535) {
|
if (tls_ca && !use_tls) {
|
||||||
fprintf(stderr, "Error: port must be between 1 and 65535\n");
|
log_message(LOG_LEVEL_WARNING, "--ca has no effect without --tls");
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
signal(SIGINT, cleanup);
|
signal(SIGINT, cleanup);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
static __thread int io_read_fd = -1;
|
static __thread int io_read_fd = -1;
|
||||||
static __thread int io_write_fd = -1;
|
static __thread int io_write_fd = -1;
|
||||||
static __thread SSL *io_ssl = NULL;
|
static SSL *io_ssl = NULL;
|
||||||
|
|
||||||
static unsigned long long io_bwlimit = 0;
|
static unsigned long long io_bwlimit = 0;
|
||||||
static long long bw_tokens = 0;
|
static long long bw_tokens = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user