aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2014-05-29 03:17:29 +0000
committerdrh <drh@noemail.net>2014-05-29 03:17:29 +0000
commitdcb3e3d62c72d45aa0ff1868f18303f2583e58b3 (patch)
tree70808a674f363cb3d744b0d3e6ee26c758a0cb5e /src
parent62cdde539c92ec60907d862125f2280e605514a5 (diff)
downloadsqlite-dcb3e3d62c72d45aa0ff1868f18303f2583e58b3.tar.gz
sqlite-dcb3e3d62c72d45aa0ff1868f18303f2583e58b3.zip
Only quote the arguments to the ".shell" and ".system" commands if they
contain spaces. FossilOrigin-Name: e58f4bd39d51c4c1a28684dab6427de81173d564
Diffstat (limited to 'src')
-rw-r--r--src/shell.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shell.c b/src/shell.c
index ddda4fd63..f51ce9a16 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -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);