From 236a77964f79b210a9a770d2859220edf284ae02 Mon Sep 17 00:00:00 2001
From: michael <michael@freepascal.org>
Date: Mon, 6 Jul 1998 12:40:59 +0000
Subject: [PATCH] + Fixed bug with stream creation flags

---
 rtl/linux/objinc.inc | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/rtl/linux/objinc.inc b/rtl/linux/objinc.inc
index 2eae930135..f4453e3da6 100644
--- a/rtl/linux/objinc.inc
+++ b/rtl/linux/objinc.inc
@@ -15,13 +15,19 @@ Var LinuxMode : longint;
     
 BEGIN
   LinuxMode:=0;
-  if (Mode and stCreate)=stCreate then
+  if Mode=stCreate then
+  Begin
      LinuxMode:=Open_Creat;
-  Case (Mode and 3) of
-  0 : LinuxMode:=LinuxMode or Open_RdOnly;
-  1 : LinuxMode:=LinuxMode or Open_WrOnly;
-  2 : LinuxMode:=LinuxMode or Open_RdWr;
-  end;
+     LinuxMode:=LinuxMode or Open_RdWr;
+  end
+  else
+   Begin
+     Case (Mode and 3) of
+      0 : LinuxMode:=LinuxMode or Open_RdOnly;
+      1 : LinuxMode:=LinuxMode or Open_WrOnly;
+      2 : LinuxMode:=LinuxMode or Open_RdWr;
+     end;
+   end;
   FileOpen:=SYS_Open (pchar(@FileName[0]),LinuxMode,438 {666 octal});
   If FileOpen=-1 then FileOpen:=0;
   DosStreamError:=Errno;