From e2ccb51b48c3f9e66da52a2554d1ea18f71c43ba Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 10 Jan 2004 00:32:50 +0000 Subject: Make it an autoconf pacakage git-svn-id: file:///home/lennart/svn/public/ivam2/trunk@25 dbf6933d-3bce-0310-9bcc-ed052ba35b35 --- src/dtmffifo.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/dtmffifo.c') 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 +#endif + #include #include #include @@ -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)); -- cgit