Fix bwlimit review: remove __thread (breaks -m), validate >0, handle nanosleep EINTR

This commit is contained in:
2026-07-16 17:00:14 +02:00
parent 09a76e2a9a
commit 3dcaf0b79d
2 changed files with 11 additions and 5 deletions
+4
View File
@@ -131,6 +131,10 @@ int main(int argc, char *argv[]) {
server_port = atoi(argv[++i]);
} else if (strcmp(argv[i], "--bwlimit") == 0 && i + 1 < argc) {
unsigned long long kbps = strtoull(argv[++i], NULL, 10);
if (kbps == 0) {
fprintf(stderr, "Error: --bwlimit must be greater than 0\n");
return 1;
}
io_set_bwlimit(kbps * 1024);
log_message(LOG_LEVEL_INFO, "Set bandwidth limit to %llu KB/s", kbps);
} else if (strcmp(argv[i], "--progress") == 0) {