Fix for bug 539
This commit is contained in:
@ -58,6 +58,7 @@ static int authMaxScale(int so, char *user, char *password);
|
|||||||
static int sendCommand(int so, char *cmd);
|
static int sendCommand(int so, char *cmd);
|
||||||
static void DoSource(int so, char *cmd);
|
static void DoSource(int so, char *cmd);
|
||||||
static void DoUsage();
|
static void DoUsage();
|
||||||
|
static int isquit(char *buf);
|
||||||
|
|
||||||
#ifdef HISTORY
|
#ifdef HISTORY
|
||||||
static char *
|
static char *
|
||||||
@ -289,7 +290,7 @@ int argno = 0;
|
|||||||
history(hist, &ev, H_ENTER, buf);
|
history(hist, &ev, H_ENTER, buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!strcasecmp(buf, "quit"))
|
if (isquit(buf))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -552,3 +553,23 @@ DoUsage()
|
|||||||
printf("Any remaining arguments are treated as MaxScale commands or a file\n");
|
printf("Any remaining arguments are treated as MaxScale commands or a file\n");
|
||||||
printf("containing commands to execute.\n");
|
printf("containing commands to execute.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check command to see if it is a quit command
|
||||||
|
*
|
||||||
|
* @param buf The command buffer
|
||||||
|
* @return Non-zero if the command should cause maxadmin to quit
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
isquit(char *buf)
|
||||||
|
{
|
||||||
|
char *ptr = buf;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
return 0;
|
||||||
|
while (*ptr && isspace(*ptr))
|
||||||
|
ptr++;
|
||||||
|
if (strncasecmp(ptr, "quit", 4) == 0 || strncasecmp(ptr, "exit", 4) == 0)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -693,8 +693,17 @@ int i;
|
|||||||
service->name)));
|
service->name)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
session->tail = *tail;
|
|
||||||
free(tail);
|
/*
|
||||||
|
* filterUpstream may simply return the 3 parameter if
|
||||||
|
* the filter has no upstream entry point. So no need
|
||||||
|
* to copy the contents or free tail in this case.
|
||||||
|
*/
|
||||||
|
if (tail != &session->tail)
|
||||||
|
{
|
||||||
|
session->tail = *tail;
|
||||||
|
free(tail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user