Show More
@@ -374,8 +374,7 b' static int runinstructions(struct cmdser' | |||||
374 |
|
374 | |||
375 | /* |
|
375 | /* | |
376 | * Test whether the command is unsupported or not. This is not designed to |
|
376 | * Test whether the command is unsupported or not. This is not designed to | |
377 |
* cover all cases. But it's fast, does not depend on the server |
|
377 | * cover all cases. But it's fast, does not depend on the server. | |
378 | * not return false positives. |
|
|||
379 | */ |
|
378 | */ | |
380 | static int isunsupported(int argc, const char *argv[]) |
|
379 | static int isunsupported(int argc, const char *argv[]) | |
381 | { |
|
380 | { | |
@@ -388,7 +387,12 b' static int isunsupported(int argc, const' | |||||
388 | for (i = 0; i < argc; ++i) { |
|
387 | for (i = 0; i < argc; ++i) { | |
389 | if (strcmp(argv[i], "--") == 0) |
|
388 | if (strcmp(argv[i], "--") == 0) | |
390 | break; |
|
389 | break; | |
391 | if (i == 0 && strcmp("serve", argv[i]) == 0) |
|
390 | /* | |
|
391 | * there can be false positives but no false negative | |||
|
392 | * we cannot assume `serve` will always be first argument | |||
|
393 | * because global options can be passed before the command name | |||
|
394 | */ | |||
|
395 | if (strcmp("serve", argv[i]) == 0) | |||
392 | state |= SERVE; |
|
396 | state |= SERVE; | |
393 | else if (strcmp("-d", argv[i]) == 0 || |
|
397 | else if (strcmp("-d", argv[i]) == 0 || | |
394 | strcmp("--daemon", argv[i]) == 0) |
|
398 | strcmp("--daemon", argv[i]) == 0) |
General Comments 0
You need to be logged in to leave comments.
Login now