Permalink
Browse files

Fix reliance on 'quit' command, including idle timeout

  • Loading branch information...
dparrish committed Feb 1, 2010
1 parent 6ddf96f commit 5acb5b39b92c1a8a815d0cf3e827d024bb6c47f2
Showing with 3 additions and 5 deletions.
  1. +3 −5 libcli.c
View
@@ -1249,7 +1249,7 @@ int cli_loop(struct cli_def *cli, int sockfd)
/* timeout every second */
if (cli->regular_callback && cli->regular_callback(cli) != CLI_OK)
{
- strncpy(cmd, "quit", CLI_MAX_LINE_LENGTH - 1);
+ l = -1;
break;
}
@@ -1258,7 +1258,7 @@ int cli_loop(struct cli_def *cli, int sockfd)
if (time(NULL) - cli->last_action >= cli->idle_timeout)
{
cli_print(cli, "Idle timeout");
- strncpy(cmd, "quit", 4095);
+ l = -1;
break;
}
}
@@ -1501,9 +1501,7 @@ int cli_loop(struct cli_def *cli, int sockfd)
if (l)
continue;
- strcpy(cmd, "quit");
- l = cursor = strlen(cmd);
- write(sockfd, "quit\r\n", l + 2);
+ l = -1;
break;
}

0 comments on commit 5acb5b3

Please sign in to comment.