summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-07-30 00:38:45 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-07-30 00:38:45 +0900
commitbd0a3960dfacda0c96dda0b4d0e9d88e7de800a9 (patch)
treed603c9086f6e31aef69e56a012e98a56a71d1989 /src
parentc659fe939df2b0830f83f39429d6e7814ac82157 (diff)
mingw32: Fix bug that aria2 does not read piped stdin
Diffstat (limited to 'src')
-rw-r--r--src/BufferedFile.cc4
-rw-r--r--src/GZipFile.cc5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/BufferedFile.cc b/src/BufferedFile.cc
index 118cfc1b..ee35006a 100644
--- a/src/BufferedFile.cc
+++ b/src/BufferedFile.cc
@@ -46,7 +46,9 @@ namespace aria2 {
BufferedFile::BufferedFile(const char* filename, const char* mode)
:
#ifdef __MINGW32__
- fp_(a2fopen(utf8ToWChar(filename).c_str(), utf8ToWChar(mode).c_str())),
+ fp_(strcmp(DEV_STDIN, filename) == 0 ?
+ stdin : a2fopen(utf8ToWChar(filename).c_str(),
+ utf8ToWChar(mode).c_str())),
#else // !__MINGW32__
fp_(a2fopen(filename, mode)),
#endif // !__MINGW32__
diff --git a/src/GZipFile.cc b/src/GZipFile.cc
index fe834271..ed2e4920 100644
--- a/src/GZipFile.cc
+++ b/src/GZipFile.cc
@@ -49,9 +49,10 @@ GZipFile::GZipFile(const char* filename, const char* mode)
{
FILE* fp =
#ifdef __MINGW32__
- a2fopen(utf8ToWChar(filename).c_str(), utf8ToWChar(mode).c_str());
+ strcmp(DEV_STDIN, filename) == 0 ?
+ stdin : a2fopen(utf8ToWChar(filename).c_str(), utf8ToWChar(mode).c_str());
#else // !__MINGW32__
- a2fopen(filename, mode);
+ a2fopen(filename, mode);
#endif // !__MINGW32__
if (fp) {