[asterisk-commits] tilghman: branch 1.8 r301402 - /branches/1.8/main/file.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 11 18:26:43 CST 2011


Author: tilghman
Date: Tue Jan 11 18:26:39 2011
New Revision: 301402

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=301402
Log:
Call execl() directly for a better solution for paths with spaces.

(closes issue #18600)
Reported by: ebroad
Patches: 
      20110111__issue18600__2.diff.txt uploaded by tilghman (license 14)

Modified:
    branches/1.8/main/file.c

Modified: branches/1.8/main/file.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/file.c?view=diff&rev=301402&r1=301401&r2=301402
==============================================================================
--- branches/1.8/main/file.c (original)
+++ branches/1.8/main/file.c Tue Jan 11 18:26:39 2011
@@ -310,11 +310,9 @@
 		ast_translator_free_path(f->trans);
 
 	if (f->realfilename && f->filename) {
-			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);
-			ast_safe_system(cmd);
+		if (ast_safe_fork(0) == 0) {
+			execl("/bin/mv", "mv", "-f", f->filename, f->realfilename, SENTINEL);
+		}
 	}
 
 	if (f->filename)




More information about the asterisk-commits mailing list