Added parameters to make a newly created file public readable or writable.
git-svn-id: http://voip.null.ro/svn/yate@2583 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
49efcf8e48
commit
dc37ede083
|
@ -627,7 +627,7 @@ bool File::setBlocking(bool block)
|
|||
}
|
||||
|
||||
bool File::openPath(const char* name, bool canWrite, bool canRead,
|
||||
bool create, bool append, bool binary)
|
||||
bool create, bool append, bool binary, bool pubReadable, bool pubWritable)
|
||||
{
|
||||
if (!terminate())
|
||||
return false;
|
||||
|
@ -674,7 +674,12 @@ bool File::openPath(const char* name, bool canWrite, bool canRead,
|
|||
flags |= O_TRUNC;
|
||||
if (binary)
|
||||
flags |= O_BINARY;
|
||||
HANDLE h = ::open(name,flags,(S_IRUSR|S_IWUSR));
|
||||
int mode = S_IRUSR|S_IWUSR;
|
||||
if (pubReadable)
|
||||
mode |= S_IRGRP|S_IROTH;
|
||||
if (pubWritable)
|
||||
mode |= S_IWGRP|S_IWOTH;
|
||||
HANDLE h = ::open(name,flags,mode);
|
||||
if (h == invalidHandle()) {
|
||||
copyError();
|
||||
return false;
|
||||
|
|
|
@ -4508,10 +4508,13 @@ public:
|
|||
* @param create Create the file if it doesn't exist
|
||||
* @param append Set the write pointer at the end of an existing file
|
||||
* @param binary Open the file in binary mode if applicable
|
||||
* @param pubReadable If the file is created make it public readable
|
||||
* @param pubWritable If the file is created make it public writable
|
||||
* @return True if the file was successfully opened
|
||||
*/
|
||||
virtual bool openPath(const char* name, bool canWrite = false, bool canRead = true,
|
||||
bool create = false, bool append = false, bool binary = false);
|
||||
bool create = false, bool append = false, bool binary = false,
|
||||
bool pubReadable = false, bool pubWritable = false);
|
||||
|
||||
/**
|
||||
* Closes the file handle
|
||||
|
|
Loading…
Reference in New Issue