]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Call execl() directly for a better solution for paths with spaces.
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 12 Jan 2011 00:26:39 +0000 (00:26 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 12 Jan 2011 00:26:39 +0000 (00:26 +0000)
(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/branches/1.8@301402 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/file.c

index a5c99d55a9d6e0cd9586e3c203c22c20c0c8c173..c37937be19fe8d09af892edd9b94dff07689bd2c 100644 (file)
@@ -310,11 +310,9 @@ static void filestream_destructor(void *arg)
                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)