#include <assert.h>
#include <unistd.h>
+#include <sys/stat.h>
#include <libavformat/avformat.h>
#include <libavutil/mathematics.h>
{
AVFormatContext *oc;
lav_muxer_t *lm = (lav_muxer_t*)m;
+ char buf[256];
+ int r;
oc = lm->lm_oc;
snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
- if(avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
- tvhlog(LOG_ERR, "libav", "Could not open %s", filename);
+ if((r = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {
+ av_strerror(r, buf, sizeof(buf));
+ tvhlog(LOG_ERR, "libav", "%s: Could not open -- %s", filename, buf);
lm->m_errors++;
return -1;
}
+ /* bypass umask settings */
+ if (chmod(filename, lm->m_config.m_file_permissions))
+ tvhlog(LOG_ERR, "libav", "%s: Unable to change permissions -- %s",
+ filename, strerror(errno));
+
return 0;
}
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
+#include <sys/stat.h>
#include "tvheadend.h"
#include "streaming.h"
return -1;
}
+ /* bypass umask settings */
+ if (fchmod(fd, pm->m_config.m_file_permissions))
+ tvhlog(LOG_ERR, "pass", "%s: Unable to change permissions -- %s",
+ filename, strerror(errno));
+
pm->pm_off = 0;
pm->pm_seekable = 1;
pm->pm_fd = fd;
return mkm->error;
}
+ /* bypass umask settings */
+ if (fchmod(fd, permissions))
+ tvhlog(LOG_ERR, "mkv", "%s: Unable to change permissions -- %s",
+ filename, strerror(errno));
+
+
mkm->filename = strdup(filename);
mkm->fd = fd;
mkm->cluster_maxsize = 2000000/4;
err = mkdir(path, mode);
if (!err && gid != -1 && uid != -1)
err = chown(path, uid, gid);
+ if (!err)
+ err = chmod(path, mode); /* override umode */
tvhtrace("settings", "Creating directory \"%s\" with octal permissions "
"\"%o\" gid %d uid %d", path, mode, gid, uid);
} else {