You might want to perform the directory test first. Done this way, the code
will exit with a an open file.

Rick

---------- Forwarded message ---------
From: erich_st--- via Oorexx-svn <oorexx-...@lists.sourceforge.net>
Date: Wed, May 1, 2019 at 9:02 AM
Subject: [Oorexx-svn] SF.net SVN: oorexx-code-0:[11876]
main/trunk/interpreter
To: <oorexx-...@lists.sourceforge.net>
Cc: <erich...@users.sf.net>


Revision: 11876
          http://sourceforge.net/p/oorexx/code-0/11876
Author:   erich_st
Date:     2019-05-01 13:02:40 +0000 (Wed, 01 May 2019)
Log Message:
-----------
fix SysSearchFile return code for an invalid file

Modified Paths:
--------------
    main/trunk/interpreter/runtime/RexxUtilCommon.cpp
    main/trunk/interpreter/streamLibrary/StreamNative.hpp

Modified: main/trunk/interpreter/runtime/RexxUtilCommon.cpp
===================================================================
--- main/trunk/interpreter/runtime/RexxUtilCommon.cpp   2019-04-29 18:22:52
UTC (rev 11875)
+++ main/trunk/interpreter/runtime/RexxUtilCommon.cpp   2019-05-01 13:02:40
UTC (rev 11876)
@@ -85,8 +85,9 @@
       */
      bool open(const char *fileName)
      {
-         // if we can't open the file, return
-         if (!file.open(fileName, RX_O_RDONLY, RX_S_IREAD, RX_SH_DENYWR))
+         // if we can't open the file or this is a directory, return
+         if (!file.open(fileName, RX_O_RDONLY, RX_S_IREAD, RX_SH_DENYWR) ||
+             SysFileSystem::isDirectory(fileName))
          {
              return false;
          }

Modified: main/trunk/interpreter/streamLibrary/StreamNative.hpp
===================================================================
--- main/trunk/interpreter/streamLibrary/StreamNative.hpp       2019-04-29
18:22:52 UTC (rev 11875)
+++ main/trunk/interpreter/streamLibrary/StreamNative.hpp       2019-05-01
13:02:40 UTC (rev 11876)
@@ -48,15 +48,7 @@
 #include "SysFile.hpp"
 #include "FileNameBuffer.hpp"

-#define nbt_line_end "\n"
-#define nbt_line_end_size 1
-
-#define std_line_end "\n"
-#define std_line_end_size 1
-
 #define ctrl_z 0x1a                    /* end-of-file marker
  */
-#define nl     '\n'                    /* new line character
  */
-#define cr     '\r'                    /* carriage return character
 */


 /*****************************************************************************/



_______________________________________________
Oorexx-svn mailing list
oorexx-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-svn
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to