[multiple changes]
2009-07-13 Thomas Quinot <quinot@adacore.com> * g-socthi-vxworks.adb (C_Sendto): VxWorks does not support the standard sendto(2) interface for connected sockets (passing a null destination address). Use send(2) instead for that case. 2009-07-13 Pascal Obry <obry@adacore.com> * adaint.c: Fix __gnat_stat() with Win32 UNC paths. From-SVN: r149559
This commit is contained in:
parent
fdd7e7bb1d
commit
223eab977a
@ -1,3 +1,13 @@
|
||||
2009-07-13 Thomas Quinot <quinot@adacore.com>
|
||||
|
||||
* g-socthi-vxworks.adb (C_Sendto): VxWorks does not support the
|
||||
standard sendto(2) interface for connected sockets (passing a null
|
||||
destination address). Use send(2) instead for that case.
|
||||
|
||||
2009-07-13 Pascal Obry <obry@adacore.com>
|
||||
|
||||
* adaint.c: Fix __gnat_stat() with Win32 UNC paths.
|
||||
|
||||
2009-07-13 Emmanuel Briot <briot@adacore.com>
|
||||
|
||||
* prj-proc.adb, prj-proc.ads, prj.ads, prj-nmsc.adb, prj-nmsc.ads,
|
||||
|
@ -1655,10 +1655,14 @@ __gnat_stat (char *name, STRUCT_STAT *statbuf)
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
/* Under Windows the directory name for the stat function must not be
|
||||
terminated by a directory separator except if just after a drive name. */
|
||||
terminated by a directory separator except if just after a drive name
|
||||
or with UNC path without directory (only the name of the shared
|
||||
resource), for example: \\computer\share\ */
|
||||
|
||||
TCHAR wname [GNAT_MAX_PATH_LEN + 2];
|
||||
int name_len;
|
||||
int name_len, k;
|
||||
TCHAR last_char;
|
||||
int dirsep_count = 0;
|
||||
|
||||
S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
|
||||
name_len = _tcslen (wname);
|
||||
@ -1675,9 +1679,17 @@ __gnat_stat (char *name, STRUCT_STAT *statbuf)
|
||||
last_char = wname[name_len - 1];
|
||||
}
|
||||
|
||||
/* Count back-slashes. */
|
||||
|
||||
for (k=0; k<name_len; k++)
|
||||
if (wname[k] == _T('\\') || wname[k] == _T('/'))
|
||||
dirsep_count++;
|
||||
|
||||
/* Only a drive letter followed by ':', we must add a directory separator
|
||||
for the stat routine to work properly. */
|
||||
if (name_len == 2 && wname[1] == _T(':'))
|
||||
if ((name_len == 2 && wname[1] == _T(':'))
|
||||
|| (name_len > 3 && wname[0] == _T('\\') && wname[1] == _T('\\')
|
||||
&& dirsep_count == 3))
|
||||
_tcscat (wname, _T("\\"));
|
||||
|
||||
return _tstat (wname, (struct _stat *)statbuf);
|
||||
|
@ -108,6 +108,13 @@ package body GNAT.Sockets.Thin is
|
||||
Flags : C.int) return C.int;
|
||||
pragma Import (C, Syscall_Sendmsg, "sendmsg");
|
||||
|
||||
function Syscall_Send
|
||||
(S : C.int;
|
||||
Msg : System.Address;
|
||||
Len : C.int;
|
||||
Flags : C.int) return C.int;
|
||||
pragma Import (C, Syscall_Send, "send");
|
||||
|
||||
function Syscall_Sendto
|
||||
(S : C.int;
|
||||
Msg : System.Address;
|
||||
@ -355,11 +362,23 @@ package body GNAT.Sockets.Thin is
|
||||
To : System.Address;
|
||||
Tolen : C.int) return C.int
|
||||
is
|
||||
use System;
|
||||
|
||||
Res : C.int;
|
||||
|
||||
begin
|
||||
loop
|
||||
Res := Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
|
||||
if To = Null_Address then
|
||||
-- In violation of the standard sockets API, VxWorks does not
|
||||
-- support sendto(2) calls on connected sockets with a null
|
||||
-- destination address, so use send(2) instead in that case.
|
||||
|
||||
Res := Syscall_Send (S, Msg, Len, Flags);
|
||||
|
||||
else
|
||||
Res := Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
|
||||
end if;
|
||||
|
||||
exit when SOSC.Thread_Blocking_IO
|
||||
or else Res /= Failure
|
||||
or else Non_Blocking_Socket (S)
|
||||
|
Loading…
Reference in New Issue
Block a user