--- p/rts/files.pas.orig Mon Mar 28 19:10:59 2005 +++ p/rts/files.pas Sat Apr 23 04:18:05 2005 @@ -424,10 +424,15 @@ implementation +{$ifndef HAVE_NO_RTS_CONFIG_H} +{$include "rts-config.inc"} +{$endif} + #define RTS_CONSTANT(NAME, VALUE) const NAME = VALUE; {$include "constants.def"} const + HaveFCntl = {$ifdef HAVE_FCNTL} True {$else} False {$endif}; ValInternalError = 999; OpenErrorCode: array [TOpenMode] of Integer = (904, 442, 443, 445, 442, 443, 444); NewPage = "\f"; @@ -1454,7 +1459,7 @@ if f^.Status.Extending <> (Mode = fo_Append) then begin f^.Status.Extending := Mode = fo_Append; - SetFileMode (f^.Handle, MODE_APPEND, f^.Status.Extending) + if HaveFCntl then SetFileMode (f^.Handle, MODE_APPEND, f^.Status.Extending) end; if Mode = fo_Append then SeekInternal (f, 0, SeekFileEnd) { Start appending (maybe redundant, but just to be safe) } @@ -1538,7 +1543,7 @@ TryOpen (f, FileName, (FileMode and FileMode_Rewrite_WriteOnly) = 0, MODE_READ or MODE_WRITE or MODE_CREATE or MODE_TRUNCATE, MODE_WRITE or MODE_CREATE or MODE_TRUNCATE, 'file is write only'); fo_Append: - TryOpen (f, FileName, (FileMode and FileMode_Extend_WriteOnly) = 0, MODE_READ or MODE_WRITE or MODE_CREATE or MODE_APPEND, + TryOpen (f, FileName, (FileMode and FileMode_Extend_WriteOnly) = 0, MODE_READ or MODE_WRITE or MODE_CREATE or (MODE_APPEND * Ord (HaveFCntl)), MODE_WRITE or MODE_CREATE or MODE_APPEND, 'file is write only'); fo_SeekWrite: TryOpen (f, FileName, True, MODE_READ or MODE_WRITE or MODE_CREATE, MODE_WRITE or MODE_CREATE, 'file is write only'); @@ -2958,10 +2963,10 @@ This is related to general undefined variable checks (hard). } if f^.Status.Undef then IOERROR_FILE (439, f, False,); { `Update' with an undefined file buffer in % } {$endif} - if f^.Status.Extending then SetFileMode (f^.Handle, MODE_APPEND, False); + if f^.Status.Extending and HaveFCntl then SetFileMode (f^.Handle, MODE_APPEND, False); SeekInternal (f, 0, SeekRelative); { Seek back possible buffered data } InternalWrite (f^.FilBuf, f^.FilSiz, f); - if f^.Status.Extending then SetFileMode (f^.Handle, MODE_APPEND, True); + if f^.Status.Extending and HaveFCntl then SetFileMode (f^.Handle, MODE_APPEND, True); { The file buffer is still f0^ } f^.Status.LGet := False; f^.Status.Undef := False