aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common/gzio.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2013-09-03 11:48:00 +0200
committerLukas Larsson <[email protected]>2014-02-24 15:15:56 +0100
commiteed38c1bb1a12015377d30e9ceff9525e050850e (patch)
treeaf9eab3b6ee2fcfbff3ae6375e275da77a37cd9d /erts/emulator/drivers/common/gzio.c
parentc743ed359f16f791dd15b58b86af7f77db4799aa (diff)
downloadotp-eed38c1bb1a12015377d30e9ceff9525e050850e.tar.gz
otp-eed38c1bb1a12015377d30e9ceff9525e050850e.tar.bz2
otp-eed38c1bb1a12015377d30e9ceff9525e050850e.zip
ose: Convert EFILE_SEEK to unistd seek for gzio
This is needed because OSE does not have the same integers as unix/win32 for SEEK_ST and friends.
Diffstat (limited to 'erts/emulator/drivers/common/gzio.c')
-rw-r--r--erts/emulator/drivers/common/gzio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/erts/emulator/drivers/common/gzio.c b/erts/emulator/drivers/common/gzio.c
index 653f3954b1..9a9e297fca 100644
--- a/erts/emulator/drivers/common/gzio.c
+++ b/erts/emulator/drivers/common/gzio.c
@@ -20,6 +20,7 @@
#endif
#include <ctype.h>
#include "erl_driver.h"
+#include "erl_efile.h"
#include "sys.h"
#ifdef __WIN32__
@@ -597,6 +598,15 @@ erts_gzseek(ErtsGzFile file, int offset, int whence)
int pos;
gz_stream* s = (gz_stream *) file;
+ switch (whence) {
+ case EFILE_SEEK_SET: whence = SEEK_SET; break;
+ case EFILE_SEEK_CUR: whence = SEEK_CUR; break;
+ case EFILE_SEEK_END: whence = SEEK_END; break;
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
if (s == NULL) {
errno = EINVAL;
return -1;