1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Files and directories are now created with rights according to the shell's umask settings

This commit is contained in:
Klaus Schmidinger 2005-08-06 09:56:08 +02:00
parent 068e17303c
commit bc22ed879c
6 changed files with 16 additions and 12 deletions

View File

@ -817,6 +817,8 @@ Andreas Brachold <vdr04@deltab.de>
for generating file dependencies for generating file dependencies
for suggesting that the 'plugins-clean' target of the Makefile should only delete for suggesting that the 'plugins-clean' target of the Makefile should only delete
the actual plugin library files from this version of VDR 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> Manuel Hartl <icecep@gmx.net>
for suggesting to extend the logging info when starting/stopping timers for suggesting to extend the logging info when starting/stopping timers

View File

@ -3634,7 +3634,7 @@ Video Disk Recorder Revision History
replaced with the new one instead of adding the new entries (thanks to Andreas replaced with the new one instead of adding the new entries (thanks to Andreas
Regel). 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 - 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). 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 - 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 before making changes through SVDRP (thanks to Andreas Brugger for reporting a
problem with this). problem with this).
- Files and directories are now created with rights according to the shell's
umask settings (thanks to Andreas Brachold).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "recording.h"
@ -199,7 +199,7 @@ int cResumeFile::Read(void)
bool cResumeFile::Save(int Index) bool cResumeFile::Save(int Index)
{ {
if (fileName) { 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 (f >= 0) {
if (safe_write(f, &Index, sizeof(Index)) < 0) if (safe_write(f, &Index, sizeof(Index)) < 0)
LOG_ERROR_STR(fileName); LOG_ERROR_STR(fileName);
@ -974,7 +974,7 @@ cIndexFile::cIndexFile(const char *FileName, bool Record)
else if (!Record) else if (!Record)
isyslog("missing index file %s", fileName); isyslog("missing index file %s", fileName);
if (Record) { 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) { if (delta) {
esyslog("ERROR: padding index file with %d '0' bytes", delta); esyslog("ERROR: padding index file with %d '0' bytes", delta);
while (delta--) while (delta--)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "tools.h"
@ -308,7 +308,7 @@ bool MakeDirs(const char *FileName, bool IsDirectory)
struct stat fs; struct stat fs;
if (stat(s, &fs) != 0 || !S_ISDIR(fs.st_mode)) { if (stat(s, &fs) != 0 || !S_ISDIR(fs.st_mode)) {
dsyslog("creating directory %s", s); 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); LOG_ERROR_STR(s);
result = false; result = false;
break; break;
@ -451,7 +451,7 @@ bool SpinUpDisk(const char *FileName)
if (access(buf, F_OK) != 0) { // the file does not exist if (access(buf, F_OK) != 0) { // the file does not exist
timeval tp1, tp2; timeval tp1, tp2;
gettimeofday(&tp1, NULL); 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 // O_SYNC doesn't work on all file systems
if (f >= 0) { if (f >= 0) {
if (fdatasync(f) < 0) if (fdatasync(f) < 0)
@ -843,7 +843,7 @@ bool cLockFile::Lock(int WaitSeconds)
if (f < 0 && fileName) { if (f < 0 && fileName) {
time_t Timeout = time(NULL) + WaitSeconds; time_t Timeout = time(NULL) + WaitSeconds;
do { 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 (f < 0) {
if (errno == EEXIST) { if (errno == EEXIST) {
struct stat fs; struct stat fs;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __TOOLS_H
@ -158,7 +158,7 @@ public:
cFile(void); cFile(void);
~cFile(); ~cFile();
operator int () { return f; } 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); bool Open(int FileDes);
void Close(void); void Close(void);
bool IsOpen(void) { return f >= 0; } bool IsOpen(void) { return f >= 0; }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #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) if (ActualFileName != FileName)
free((char *)ActualFileName); free((char *)ActualFileName);
return Result; return Result;