summaryrefslogtreecommitdiffstats
path: root/src/dtmffifo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dtmffifo.c')
-rw-r--r--src/dtmffifo.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/dtmffifo.c b/src/dtmffifo.c
index f959158..c584232 100644
--- a/src/dtmffifo.c
+++ b/src/dtmffifo.c
@@ -1,3 +1,27 @@
+/* $Id$ */
+
+/***
+ This file is part of ivam2.
+
+ ivam2 is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ ivam2 is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ivam2; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <unistd.h>
#include <libdaemon/dlog.h>
#include <limits.h>
@@ -14,6 +38,7 @@
struct dtmf_fifo* dtmf_fifo_new(void) {
struct dtmf_fifo *d = NULL;
char p[PATH_MAX];
+ mode_t u;
d = malloc(sizeof(struct dtmf_fifo));
assert(d);
@@ -23,7 +48,9 @@ struct dtmf_fifo* dtmf_fifo_new(void) {
d->dir = strdup("/tmp/ivamd.XXXXXX");
assert(d->dir);
+ u = umask(0077);
if (!mkdtemp(d->dir)) {
+ umask(u);
daemon_log(LOG_ERR, "Failed to create temporary directory '%s': %s", d->dir, strerror(errno));
goto fail;
}
@@ -33,9 +60,12 @@ struct dtmf_fifo* dtmf_fifo_new(void) {
assert(d->fname);
if (mkfifo(d->fname, 0700) != 0) {
+ umask(u);
daemon_log(LOG_ERR, "Failed to create FIFO '%s': %s", d->fname, strerror(errno));
goto fail;
}
+
+ umask(u);
if ((d->fd = open(d->fname, O_RDWR|O_NDELAY)) < 0) {
daemon_log(LOG_ERR, "Failed to open FIFO '%s': %s", d->fname, strerror(errno));