Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
settings: use proper stat macro's for tvh_open
Using the numerical shortcut for mode_t is strongly discouraged and not
portable. Instead, use the portable macro's from sys/stat.h

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
  • Loading branch information
oliv3r authored and perexg committed Sep 29, 2015
1 parent 39f1b73 commit b260c8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/input/mpegts/mpegts_input.c
Expand Up @@ -722,12 +722,12 @@ mpegts_input_started_mux
mpegts_mux_nice_name(mmi->mmi_mux, buf, sizeof(buf));
snprintf(path, sizeof(path), "%s/%s-%li-%p-mux.ts", tvheadend_tsdebug,
buf, (long)dispatch_clock, mi);
mmi->mmi_mux->mm_tsdebug_fd = tvh_open(path, O_WRONLY | O_CREAT, 0600);
mmi->mmi_mux->mm_tsdebug_fd = tvh_open(path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
if (mmi->mmi_mux->mm_tsdebug_fd < 0)
tvherror("tsdebug", "unable to create file '%s' (%i)", path, errno);
snprintf(path, sizeof(path), "%s/%s-%li-%p-input.ts", tvheadend_tsdebug,
buf, (long)dispatch_clock, mi);
mmi->mmi_mux->mm_tsdebug_fd2 = tvh_open(path, O_WRONLY | O_CREAT, 0600);
mmi->mmi_mux->mm_tsdebug_fd2 = tvh_open(path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
if (mmi->mmi_mux->mm_tsdebug_fd2 < 0)
tvherror("tsdebug", "unable to create file '%s' (%i)", path, errno);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/settings.c
Expand Up @@ -150,7 +150,7 @@ hts_settings_save(htsmsg_t *record, const char *pathfmt, ...)

/* Create tmp file */
snprintf(tmppath, sizeof(tmppath), "%s.tmp", path);
if((fd = tvh_open(tmppath, O_CREAT | O_TRUNC | O_RDWR, 0700)) < 0) {
if((fd = tvh_open(tmppath, O_CREAT | O_TRUNC | O_RDWR, S_IRWXU)) < 0) {
tvhlog(LOG_ALERT, "settings", "Unable to create \"%s\" - %s",
tmppath, strerror(errno));
return;
Expand Down Expand Up @@ -361,7 +361,7 @@ hts_settings_open_file(int for_write, const char *pathfmt, ...)
/* Open file */
int flags = for_write ? O_CREAT | O_TRUNC | O_WRONLY : O_RDONLY;

return tvh_open(path, flags, 0700);
return tvh_open(path, flags, S_IRWXU);
}

/*
Expand Down

0 comments on commit b260c8c

Please sign in to comment.