aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_sms.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-22 04:35:12 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-22 04:35:12 +0000
commited2b193e6c6d0cce882796969369e305075103e0 (patch)
tree45f02eef0ac120e193459b71f73a7b62b7db8784 /apps/app_sms.c
parentde3fbdf9699a307db497cd68d3d9d044936d7b4f (diff)
Issue 9990 - New API ast_mkdir, which creates parent directories as necessary (and is faster than an outcall to mkdir -p)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@71040 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_sms.c')
-rw-r--r--apps/app_sms.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/apps/app_sms.c b/apps/app_sms.c
index f1022bb26..d29ab6985 100644
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -916,10 +916,8 @@ static void sms_writefile(sms_t * h)
char buf[30];
FILE *o;
- ast_copy_string(fn, spool_dir, sizeof (fn));
- mkdir(fn, 0777); /* ensure it exists */
- snprintf(fn + strlen (fn), sizeof (fn) - strlen (fn), "/%s", h->smsc ? h->rx ? "morx" : "mttx" : h->rx ? "mtrx" : "motx");
- mkdir(fn, 0777); /* ensure it exists */
+ snprintf(fn, sizeof(fn), "%s/%s", spool_dir, h->smsc ? h->rx ? "morx" : "mttx" : h->rx ? "mtrx" : "motx");
+ ast_mkdir(fn, 0777); /* ensure it exists */
ast_copy_string(fn2, fn, sizeof (fn2));
snprintf(fn2 + strlen (fn2), sizeof (fn2) - strlen (fn2), "/%s.%s-%d", h->queue, isodate(h->scts, buf, sizeof(buf)), seq++);
snprintf (fn + strlen (fn), sizeof (fn) - strlen (fn), "/.%s", fn2 + strlen (fn) + 1);
@@ -1339,11 +1337,9 @@ static void sms_nextoutgoing (sms_t * h)
char more = 0;
*h->da = *h->oa = '\0'; /* clear destinations */
- ast_copy_string (fn, spool_dir, sizeof (fn));
- mkdir(fn, 0777); /* ensure it exists */
h->rx = 0; /* outgoing message */
- snprintf (fn + strlen (fn), sizeof (fn) - strlen (fn), "/%s", h->smsc ? "mttx" : "motx");
- mkdir (fn, 0777); /* ensure it exists */
+ snprintf(fn, sizeof(fn), "%s/%s", spool_dir, h->smsc ? "mttx" : "motx");
+ ast_mkdir(fn, 0777); /* ensure it exists */
d = opendir (fn);
if (d) {
struct dirent *f = readdirqueue (d, h->queue);