summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-08-06 09:56:08 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-08-06 09:56:08 +0200
commitbc22ed879c05836e0f1d5e40f0f4a052d1f9d511 (patch)
tree43cc2c754bc9a18913b4bbb37a440446762cfa3b
parent068e17303c93dcca4521a8f9c09eb7b8a4dc5104 (diff)
downloadvdr-bc22ed879c05836e0f1d5e40f0f4a052d1f9d511.tar.gz
vdr-bc22ed879c05836e0f1d5e40f0f4a052d1f9d511.tar.bz2
Files and directories are now created with rights according to the shell's umask settings
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY4
-rw-r--r--recording.c6
-rw-r--r--tools.c8
-rw-r--r--tools.h4
-rw-r--r--videodir.c4
6 files changed, 16 insertions, 12 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 3b5581dd..7f222839 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -817,6 +817,8 @@ Andreas Brachold <vdr04@deltab.de>
for generating file dependencies
for suggesting that the 'plugins-clean' target of the Makefile should only delete
the actual plugin library files from this version of VDR
+ for making files and directories created with rights according to the shell's
+ umask settings
Manuel Hartl <icecep@gmx.net>
for suggesting to extend the logging info when starting/stopping timers
diff --git a/HISTORY b/HISTORY
index 07e78a14..600b83c4 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3634,7 +3634,7 @@ Video Disk Recorder Revision History
replaced with the new one instead of adding the new entries (thanks to Andreas
Regel).
-2005-07-31: Version 1.3.28
+2005-08-06: Version 1.3.28
- Added a sleep in cDvbPlayer::Action() in case there is no data to send to the
device, which avoids a busy loop on very fast machines (thanks to Martin Wache).
@@ -3653,3 +3653,5 @@ Video Disk Recorder Revision History
- Now checking whether timers or channels are currently being edited via the menu
before making changes through SVDRP (thanks to Andreas Brugger for reporting a
problem with this).
+- Files and directories are now created with rights according to the shell's
+ umask settings (thanks to Andreas Brachold).
diff --git a/recording.c b/recording.c
index 462b1600..081f9e61 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 1.109 2005/06/05 14:11:45 kls Exp $
+ * $Id: recording.c 1.110 2005/08/06 09:53:21 kls Exp $
*/
#include "recording.h"
@@ -199,7 +199,7 @@ int cResumeFile::Read(void)
bool cResumeFile::Save(int Index)
{
if (fileName) {
- int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
if (f >= 0) {
if (safe_write(f, &Index, sizeof(Index)) < 0)
LOG_ERROR_STR(fileName);
@@ -974,7 +974,7 @@ cIndexFile::cIndexFile(const char *FileName, bool Record)
else if (!Record)
isyslog("missing index file %s", fileName);
if (Record) {
- if ((f = open(fileName, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) {
+ if ((f = open(fileName, O_WRONLY | O_CREAT | O_APPEND, DEFFILEMODE)) >= 0) {
if (delta) {
esyslog("ERROR: padding index file with %d '0' bytes", delta);
while (delta--)
diff --git a/tools.c b/tools.c
index 55612165..ca4b0b80 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.95 2005/05/29 10:18:26 kls Exp $
+ * $Id: tools.c 1.96 2005/08/06 09:53:21 kls Exp $
*/
#include "tools.h"
@@ -308,7 +308,7 @@ bool MakeDirs(const char *FileName, bool IsDirectory)
struct stat fs;
if (stat(s, &fs) != 0 || !S_ISDIR(fs.st_mode)) {
dsyslog("creating directory %s", s);
- if (mkdir(s, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == -1) {
+ if (mkdir(s, ACCESSPERMS) == -1) {
LOG_ERROR_STR(s);
result = false;
break;
@@ -451,7 +451,7 @@ bool SpinUpDisk(const char *FileName)
if (access(buf, F_OK) != 0) { // the file does not exist
timeval tp1, tp2;
gettimeofday(&tp1, NULL);
- int f = open(buf, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ int f = open(buf, O_WRONLY | O_CREAT, DEFFILEMODE);
// O_SYNC doesn't work on all file systems
if (f >= 0) {
if (fdatasync(f) < 0)
@@ -843,7 +843,7 @@ bool cLockFile::Lock(int WaitSeconds)
if (f < 0 && fileName) {
time_t Timeout = time(NULL) + WaitSeconds;
do {
- f = open(fileName, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ f = open(fileName, O_WRONLY | O_CREAT | O_EXCL, DEFFILEMODE);
if (f < 0) {
if (errno == EEXIST) {
struct stat fs;
diff --git a/tools.h b/tools.h
index 079e58d0..0644f4e6 100644
--- a/tools.h
+++ b/tools.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 1.72 2005/05/29 10:24:54 kls Exp $
+ * $Id: tools.h 1.73 2005/08/06 09:53:21 kls Exp $
*/
#ifndef __TOOLS_H
@@ -158,7 +158,7 @@ public:
cFile(void);
~cFile();
operator int () { return f; }
- bool Open(const char *FileName, int Flags, mode_t Mode = S_IRUSR | S_IWUSR | S_IRGRP);
+ bool Open(const char *FileName, int Flags, mode_t Mode = DEFFILEMODE);
bool Open(int FileDes);
void Close(void);
bool IsOpen(void) { return f >= 0; }
diff --git a/videodir.c b/videodir.c
index f0e54fe7..cb3d29a8 100644
--- a/videodir.c
+++ b/videodir.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: videodir.c 1.11 2004/12/26 11:52:12 kls Exp $
+ * $Id: videodir.c 1.12 2005/08/06 09:53:21 kls Exp $
*/
#include "videodir.h"
@@ -137,7 +137,7 @@ int OpenVideoFile(const char *FileName, int Flags)
}
}
}
- int Result = open(ActualFileName, Flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ int Result = open(ActualFileName, Flags, DEFFILEMODE);
if (ActualFileName != FileName)
free((char *)ActualFileName);
return Result;