Skip to content

Commit

Permalink
Merge branch 'mr/jicquel/27.read-symbolic-link' into 'master'
Browse files Browse the repository at this point in the history
Adapt Read_Symbolic_Link for 32-bit architectures

See merge request eng/toolchain/gnatcoll-core!63
  • Loading branch information
Jicquel committed Jan 31, 2024
2 parents 166b493 + 69ddf2d commit c3f67f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/os/gnatcoll-os-fsutil-read_symbolic_link__unix.adb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
------------------------------------------------------------------------------

with Interfaces.C;
with GNATCOLL.Memory; use GNATCOLL.Memory;
with GNATCOLL.OS.Libc; use GNATCOLL.OS.Libc;
with GNATCOLL.String_Builders;
with Ada.Strings.Unbounded;
Expand All @@ -38,13 +39,12 @@ is
use all type SB.Static_String_Builder;

Link_C_Path : SB.Static_String_Builder (Link_Path'Length + 1);
Bytes_Read : Sint_64;
Bytes_Read : GNATCOLL.Memory.ssize_t;
C_Buf : C.char_array (1 .. 4096) := (others => C.nul);
-- PATH_MAX is usually set to 4096 bytes, so we set the maximum
-- target path length to this value.

begin

Append (Link_C_Path, Link_Path);

Bytes_Read :=
Expand Down
6 changes: 4 additions & 2 deletions src/os/unix/gnatcoll-os-libc.ads
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ package GNATCOLL.OS.Libc is
Import => True, Convention => C, External_Name => "symlinkat";

function ReadLink
(Path_Name : C_String; Buf : out char_array; Buf_Size : Uint_64)
return Sint_64 with
(Path_Name : C_String;
Buf : out char_array;
Buf_Size : GNATCOLL.Memory.size_t)
return GNATCOLL.Memory.ssize_t with
Import => True, Convention => C, External_Name => "readlink";

end GNATCOLL.OS.Libc;

0 comments on commit c3f67f5

Please sign in to comment.