All pastes #113943 Raw Edit

Stuff

public text v1 · immutable
·published 2006-08-03 20:50 UTC
rendered paste body
Index: apps/app_dial.c
===================================================================
--- apps/app_dial.c     (revision 38849)
+++ apps/app_dial.c     (working copy)
@@ -37,6 +37,7 @@
 #include <stdio.h>
 #include <sys/time.h>
 #include <sys/signal.h>
+#include <sys/stat.h>
 #include <netinet/in.h>

 #include "asterisk/lock.h"
@@ -795,6 +796,7 @@
        int result = 0;
        time_t start_time;
        char privintro[1024];
+       char privdir[1024];
        char privcid[256];
        char *parse;
        int opermode = 0;
@@ -1001,7 +1003,11 @@
                           unless it is already there-- this should be done before the
                           call is actually dialed  */

-                       /* make sure the priv-callerintros dir exists? */
+                       /* make sure the priv-callerintros dir actually exists */
+                       snprintf(privdir,sizeof(privdir), "%s/sounds/priv-callerintros", ast_config_AST_DATA_DIR);
+                       if (mkdir(privdir, 0755) && errno != EEXIST) {
+                               ast_log(LOG_WARNING, "privacy: can't create directory priv-callerintros: %s\n", strerror(errno));
+                       }

                        snprintf(privintro,sizeof(privintro), "priv-callerintros/%s", privcid);
                        if( ast_fileexists(privintro,NULL,NULL ) > 0 && strncmp(privcid,"NOCALLERID",10) != 0) {