diff --git a/rtl/aros/sysfile.inc b/rtl/aros/sysfile.inc
index 6a0e72801b..b5b5829e6a 100644
--- a/rtl/aros/sysfile.inc
+++ b/rtl/aros/sysfile.inc
@@ -198,7 +198,7 @@ var dosResult: LongInt;
 begin
   checkCTRLC;
   do_write:=0;
-  if (len<=0) or (h<=0) then exit;
+  if (len<=0) or (h=0) or (h=-1) then exit;
 
 {$IFDEF MOSFPC_FILEDEBUG}
   if not ((h=StdOutputHandle) or (h=StdInputHandle) or
@@ -218,7 +218,7 @@ var dosResult: LongInt;
 begin
   checkCTRLC;
   do_read:=0;
-  if (len<=0) or (h<=0) then exit;
+  if (len<=0) or (h=0) or (h=-1) then exit;
 
 {$IFDEF MOSFPC_FILEDEBUG}
   if not ((h=StdOutputHandle) or (h=StdInputHandle) or
diff --git a/rtl/aros/sysutils.pp b/rtl/aros/sysutils.pp
index 7610b99614..98a4924e05 100644
--- a/rtl/aros/sysutils.pp
+++ b/rtl/aros/sysutils.pp
@@ -236,7 +236,7 @@ end;
 function FileRead(Handle: LongInt; out Buffer; Count: LongInt): LongInt;
 begin
   FileRead:=-1;
-  if (Count<=0) or (Handle<=0) then exit;
+  if (Count<=0) or (Handle=0) or (Handle=-1) then exit;
 
   FileRead:=dosRead(Handle,@Buffer,Count);
 end;
@@ -245,7 +245,7 @@ end;
 function FileWrite(Handle: LongInt; const Buffer; Count: LongInt): LongInt;
 begin
   FileWrite:=-1;
-  if (Count<=0) or (Handle<=0) then exit;
+  if (Count<=0) or (Handle=0) or (Handle=-1) then exit;
 
   FileWrite:=dosWrite(Handle,@Buffer,Count);
 end;
@@ -256,7 +256,7 @@ var
   seekMode: LongInt;
 begin
   FileSeek:=-1;
-  if (Handle<=0) then exit;
+  if (Handle=0) or (Handle=-1) then exit;
 
   case Origin of
     fsFromBeginning: seekMode:=OFFSET_BEGINNING;
@@ -276,7 +276,7 @@ end;
 
 procedure FileClose(Handle: LongInt);
 begin
-  if (Handle<=0) then exit;
+  if (Handle=0) or (Handle=-1) then exit;
 
   dosClose(Handle);
   RemoveFromList(MOS_fileList,Handle);
@@ -292,7 +292,7 @@ begin
   if Size > high (longint) then exit;
 {$WARNING Possible support for 64-bit FS to be checked!}
 
-  if (Handle<=0) then exit;
+  if (Handle=0) or (Handle=-1) then exit;
 
   dosResult:=SetFileSize(Handle, Size, OFFSET_BEGINNING);
   if (dosResult<0) then exit;