From 1d48790cc29e63e5f0c0e7ccd018803aa64aaa5b Mon Sep 17 00:00:00 2001
From: Tilghman Lesher <tilghman@meg.abyt.es>
Date: Wed, 29 Dec 2010 22:03:50 +0000
Subject: [PATCH] Merged revisions 299989 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r299989 | tilghman | 2010-12-29 16:02:59 -0600 (Wed, 29 Dec 2010) | 4 lines

  Quote arguments, just in case there's a space in a pathname.

  (Diagnosed by pabelanger on #asterisk-dev, fixed by me.)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@299990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_voicemail.c | 6 +++---
 main/file.c          | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 68f80b8874..26f0c77bcf 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -12382,7 +12382,7 @@ AST_TEST_DEFINE(test_voicemail_msgcount)
 	}
 
 	/* Make sure the original path was completely empty */
-	snprintf(syscmd, sizeof(syscmd), "rm -rf %s%s/%s", VM_SPOOL_DIR, testcontext, testmailbox);
+	snprintf(syscmd, sizeof(syscmd), "rm -rf \"%s%s/%s\"", VM_SPOOL_DIR, testcontext, testmailbox);
 	if ((syserr = ast_safe_system(syscmd))) {
 		ast_test_status_update(test, "Unable to clear test directory: %s\n",
 			syserr > 0 ? strerror(syserr) : "unable to fork()");
@@ -12413,7 +12413,7 @@ AST_TEST_DEFINE(test_voicemail_msgcount)
 		snprintf(tmp[i].txtfile, sizeof(tmp[i].txtfile), "%s.txt", tmp[i].file);
 
 		if (ast_fileexists(origweasels, "gsm", "en") > 0) {
-			snprintf(syscmd, sizeof(syscmd), "cp %s/sounds/en/%s.gsm %s/%s/%s/%s/msg0000.gsm", ast_config_AST_DATA_DIR, origweasels,
+			snprintf(syscmd, sizeof(syscmd), "cp \"%s/sounds/en/%s.gsm\" \"%s/%s/%s/%s/msg0000.gsm\"", ast_config_AST_DATA_DIR, origweasels,
 				VM_SPOOL_DIR, testcontext, testmailbox, folders[i]);
 			if ((syserr = ast_safe_system(syscmd))) {
 				ast_test_status_update(test, "Unable to create test voicemail: %s\n",
@@ -12496,7 +12496,7 @@ AST_TEST_DEFINE(test_voicemail_msgcount)
 #endif
 
 	/* And remove test directory */
-	snprintf(syscmd, sizeof(syscmd), "rm -rf %s%s/%s", VM_SPOOL_DIR, testcontext, testmailbox);
+	snprintf(syscmd, sizeof(syscmd), "rm -rf \"%s%s/%s\"", VM_SPOOL_DIR, testcontext, testmailbox);
 	if ((syserr = ast_safe_system(syscmd))) {
 		ast_test_status_update(test, "Unable to clear test directory: %s\n",
 			syserr > 0 ? strerror(syserr) : "unable to fork()");
diff --git a/main/file.c b/main/file.c
index 2f6cb31401..349609d300 100644
--- a/main/file.c
+++ b/main/file.c
@@ -315,7 +315,7 @@ static void filestream_destructor(void *arg)
 			size = strlen(f->filename) + strlen(f->realfilename) + 15;
 			cmd = alloca(size);
 			memset(cmd,0,size);
-			snprintf(cmd,size,"/bin/mv -f %s %s",f->filename,f->realfilename);
+			snprintf(cmd, size, "/bin/mv -f \"%s\" \"%s\"", f->filename, f->realfilename);
 			ast_safe_system(cmd);
 	}
 
-- 
GitLab