mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 08:35:07 -05:00
Print error message on invalid syntax with all chronyc commands
This commit is contained in:
9
client.c
9
client.c
@@ -613,9 +613,7 @@ process_cmd_local(CMD_Request *msg, const char *line)
|
|||||||
|
|
||||||
p = line;
|
p = line;
|
||||||
|
|
||||||
if (!*p) {
|
if (!strcmp(p, "off")) {
|
||||||
return 0;
|
|
||||||
} else if (!strcmp(p, "off")) {
|
|
||||||
msg->data.local.on_off = htonl(0);
|
msg->data.local.on_off = htonl(0);
|
||||||
msg->data.local.stratum = htonl(0);
|
msg->data.local.stratum = htonl(0);
|
||||||
} else if (sscanf(p, "stratum%d", &stratum) == 1) {
|
} else if (sscanf(p, "stratum%d", &stratum) == 1) {
|
||||||
@@ -639,15 +637,14 @@ process_cmd_manual(CMD_Request *msg, const char *line)
|
|||||||
|
|
||||||
p = line;
|
p = line;
|
||||||
|
|
||||||
if (!*p) {
|
if (!strcmp(p, "off")) {
|
||||||
return 0;
|
|
||||||
} else if (!strcmp(p, "off")) {
|
|
||||||
msg->data.manual.option = htonl(0);
|
msg->data.manual.option = htonl(0);
|
||||||
} else if (!strcmp(p, "on")) {
|
} else if (!strcmp(p, "on")) {
|
||||||
msg->data.manual.option = htonl(1);
|
msg->data.manual.option = htonl(1);
|
||||||
} else if (!strcmp(p, "reset")) {
|
} else if (!strcmp(p, "reset")) {
|
||||||
msg->data.manual.option = htonl(2);
|
msg->data.manual.option = htonl(2);
|
||||||
} else {
|
} else {
|
||||||
|
fprintf(stderr, "Invalid syntax for manual command\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
msg->command = htons(REQ_MANUAL);
|
msg->command = htons(REQ_MANUAL);
|
||||||
|
|||||||
Reference in New Issue
Block a user