Merged revisions 301402 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 12 Jan 2011 00:27:30 +0000 (00:27 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 12 Jan 2011 00:27:30 +0000 (00:27 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r301402 | tilghman | 2011-01-11 18:26:39 -0600 (Tue, 11 Jan 2011) | 7 lines

  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)
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@301403 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/file.c

index 349609d..096e556 100644 (file)
@@ -312,11 +312,9 @@ static void filestream_destructor(void *arg)
                ast_translator_free_path(f->trans);
 
        if (f->realfilename && f->filename) {
                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)
        }
 
        if (f->filename)