aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2012-09-11 08:20:43 +0200
committerMarc Hoersken <info@marc-hoersken.de>2012-09-11 08:20:43 +0200
commit71813f5e46d99ec19685a7359a40bbc3076b16c2 (patch)
tree4f3b918b92589993c2bce4390db06e1aeb610857
parenta6df3550cf5e28eba08a449fb820469ed316389e (diff)
tool_metalink.c: Fixed error: 'O_BINARY' undeclared
Check for O_BINARY which is not available on every system.
-rw-r--r--src/tool_metalink.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/tool_metalink.c b/src/tool_metalink.c
index 773158711..b9c291851 100644
--- a/src/tool_metalink.c
+++ b/src/tool_metalink.c
@@ -337,10 +337,15 @@ static int check_hash(const char *filename,
{
unsigned char *result;
digest_context *dctx;
- int check_ok;
- int fd;
+ int check_ok, flags, fd;
+
+ flags = O_RDONLY;
+#ifdef O_BINARY
/* O_BINARY is required in order to avoid binary EOF in text mode */
- fd = open(filename, O_RDONLY | O_BINARY);
+ flags |= O_BINARY;
+#endif
+
+ fd = open(filename, flags);
if(fd == -1) {
fprintf(error, "Metalink: validating (%s) FAILED (%s)\n", filename,
strerror(errno));