aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Karlsson <[email protected]>2013-10-15 16:59:38 +0200
committerLukas Larsson <[email protected]>2014-02-24 15:15:57 +0100
commite2d4b774f4141bdf530696c0abe3704655ed3aa3 (patch)
tree97af2b3d43357e690520a3a47f3a201de00b0d4a
parent3a4bdad8b488a6e7a4a18a95573059d5a21589c8 (diff)
downloadotp-e2d4b774f4141bdf530696c0abe3704655ed3aa3.tar.gz
otp-e2d4b774f4141bdf530696c0abe3704655ed3aa3.tar.bz2
otp-e2d4b774f4141bdf530696c0abe3704655ed3aa3.zip
ose: lseek() to use SEEK_CUR
This is needed because OSE does not use 1 for SEEK_CUR
-rw-r--r--erts/emulator/drivers/ose/ose_efile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/erts/emulator/drivers/ose/ose_efile.c b/erts/emulator/drivers/ose/ose_efile.c
index 8cd34a7bb0..fc255e11ef 100644
--- a/erts/emulator/drivers/ose/ose_efile.c
+++ b/erts/emulator/drivers/ose/ose_efile.c
@@ -33,8 +33,10 @@
#include "erl_efile.h"
/*#include <utime.h>*/
#ifdef HAVE_UNISTD_H
+#ifndef __OSE__
#include <unistd.h>
#endif
+#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/types.h>
#include <sys/uio.h>
@@ -60,8 +62,11 @@
#endif
#ifdef __OSE__
+#include "unistd.h"
#include "sys/stat.h"
#include "dirent.h"
+#include "sys/time.h"
+#include "time.h"
#endif
/* Find a definition of MAXIOV, that is used in the code later. */
@@ -826,10 +831,8 @@ efile_truncate_file(Efile_error* errInfo, int *fd, int flags)
{
#ifndef NO_FTRUNCATE
off_t offset;
-
- return check_error((offset = lseek(*fd, 0, 1)) >= 0 &&
- ftruncate(*fd, offset) == 0 ? 1 : -1,
- errInfo);
+ return check_error((offset = lseek(*fd, 0, SEEK_CUR)) >= 0 &&
+ ftruncate(*fd, offset) == 0 ? 1 : -1, errInfo);
#else
return 1;
#endif