]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Ensure that file is not locked on windows when opened RO
authorTonu Naks <naks@adacore.com>
Wed, 19 Nov 2025 12:56:55 +0000 (12:56 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 5 Dec 2025 12:22:52 +0000 (13:22 +0100)
gcc/ada/ChangeLog:

* adaint.c: use the _tsopen macro when opening RO file

gcc/ada/adaint.c

index adc39517280a8120359a24bd816a80ba49d72237..1b99312630c9dd69f547154db47d0b9b48086f17 100644 (file)
@@ -179,6 +179,7 @@ extern "C" {
 #elif defined (__MINGW32__) || defined (__CYGWIN__)
 
 #include "mingw32.h"
+#include "share.h"
 
 /* Current code page and CCS encoding to use, set in rtinit.c.  */
 UINT __gnat_current_codepage;
@@ -940,7 +941,7 @@ __gnat_open_read (char *path, int fmode)
    TCHAR wpath[GNAT_MAX_PATH_LEN];
 
    S2WSC (wpath, path, GNAT_MAX_PATH_LEN);
-   fd = _topen (wpath, O_RDONLY | o_fmode, 0444);
+   fd = _tsopen (wpath, O_RDONLY | o_fmode, _SH_DENYNO, 0444);
  }
 #else
   fd = GNAT_OPEN (path, O_RDONLY | o_fmode);