From e2d4b774f4141bdf530696c0abe3704655ed3aa3 Mon Sep 17 00:00:00 2001 From: Jonas Karlsson Date: Tue, 15 Oct 2013 16:59:38 +0200 Subject: ose: lseek() to use SEEK_CUR This is needed because OSE does not use 1 for SEEK_CUR --- erts/emulator/drivers/ose/ose_efile.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'erts/emulator') 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 */ #ifdef HAVE_UNISTD_H +#ifndef __OSE__ #include #endif +#endif #ifdef HAVE_SYS_UIO_H #include #include @@ -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 -- cgit v1.2.3