1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-03 16:53:36 +03:00

Only quote the arguments to the ".shell" and ".system" commands if they

contain spaces.

FossilOrigin-Name: e58f4bd39d51c4c1a28684dab6427de81173d564
This commit is contained in:
drh
2014-05-29 03:17:29 +00:00
parent 62cdde539c
commit dcb3e3d62c
3 changed files with 10 additions and 9 deletions

View File

@@ -2909,9 +2909,10 @@ static int do_meta_command(char *zLine, struct callback_data *p){
){
char *zCmd;
int i;
zCmd = sqlite3_mprintf("\"%s\"", azArg[1]);
zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]);
for(i=2; i<nArg; i++){
zCmd = sqlite3_mprintf("%z \"%s\"", zCmd, azArg[i]);
zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"",
zCmd, azArg[i]);
}
system(zCmd);
sqlite3_free(zCmd);