Skip to content

Commit

Permalink
Merge pull request #23 from ricochet1k/threadedfilefix
Browse files Browse the repository at this point in the history
Fix mode of created deps.txt and correct error message
  • Loading branch information
s-ludwig committed Apr 28, 2012
2 parents 69a7870 + 61432c4 commit 6785a79
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/vibe/core/drivers/threadedfile.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import vibe.core.log;
import vibe.core.driver;

import std.algorithm;
import std.conv;
import std.exception;
import std.string;

Expand Down Expand Up @@ -69,14 +70,16 @@ class ThreadedFileStream : FileStream {
m_fileDescriptor = open(path.toStringz(), O_RDONLY|O_BINARY);
break;
case FileMode.CreateTrunc:
m_fileDescriptor = open(path.toStringz(), O_WRONLY|O_CREAT|O_TRUNC|O_BINARY);
m_fileDescriptor = open(path.toStringz(), O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, octal!644);
break;
case FileMode.Append:
m_fileDescriptor = open(path.toStringz(), O_WRONLY|O_CREAT|O_APPEND|O_BINARY);
m_fileDescriptor = open(path.toStringz(), O_WRONLY|O_CREAT|O_APPEND|O_BINARY, octal!644);
break;
}
if( m_fileDescriptor < 0 )
throw new Exception("Failed to open '"~path~"' for reading.");
throw new Exception("Failed to open '"~path~"' for " ~ (m_mode == FileMode.Read ? "reading.":
m_mode == FileMode.CreateTrunc ? "writing." :
"appending."));

version(linux){
// stat_t seems to be defined wrong on linux/64
Expand Down

0 comments on commit 6785a79

Please sign in to comment.