diff options
Diffstat (limited to 'pd_server.c')
-rw-r--r-- | pd_server.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pd_server.c b/pd_server.c index 829a6f7..7c5a01f 100644 --- a/pd_server.c +++ b/pd_server.c @@ -35,14 +35,14 @@ main(int argc, char *argv[]) int port = 8068; int a_payment = 0, b_payment = 0, rounds, i; int optval = 1; + char *endptr; - if (argc < 2) { + errno = 0; + if (argc < 2 || (rounds = strtol(argv[1], NULL, 10)) <= 0 || errno!=0) { fprintf(stderr, "usage: %s number-of-rounds\n", argv[0]); exit(EXIT_FAILURE); } - rounds = atoi(argv[1]); - sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) return EXIT_FAILURE; |