Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions winsup/cygwin/fhandler/socket_inet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
#undef u_long
#define u_long __ms_u_long
#include <w32api/ws2tcpip.h>
/* 2025-06-09: win32api headers v13 now define a cmsghdr type which clashes with
our socket.h. Arrange not to see it here. */
#undef cmsghdr
#define cmsghdr __ms_cmsghdr
#include <w32api/mswsock.h>
#undef cmsghdr
#include <w32api/mstcpip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
Expand Down
5 changes: 5 additions & 0 deletions winsup/cygwin/fhandler/socket_local.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
#define u_long __ms_u_long
#include "ntsecapi.h"
#include <w32api/ws2tcpip.h>
/* 2025-06-09: win32api headers v13 now define a cmsghdr type which clashes with
our socket.h. Arrange not to see it here. */
#undef cmsghdr
#define cmsghdr __ms_cmsghdr
#include <w32api/mswsock.h>
#undef cmsghdr
#include <unistd.h>
#include <asm/byteorder.h>
#include <sys/socket.h>
Expand Down
4 changes: 4 additions & 0 deletions winsup/cygwin/local_includes/ntdll.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ typedef struct _FILE_DISPOSITION_INFORMATION_EX // 64
ULONG Flags;
} FILE_DISPOSITION_INFORMATION_EX, *PFILE_DISPOSITION_INFORMATION_EX;

#if __MINGW64_VERSION_MAJOR < 13

typedef struct _FILE_STAT_INFORMATION // 68
{
LARGE_INTEGER FileId;
Expand All @@ -509,6 +511,8 @@ typedef struct _FILE_CASE_SENSITIVE_INFORMATION // 71
ULONG Flags;
} FILE_CASE_SENSITIVE_INFORMATION, *PFILE_CASE_SENSITIVE_INFORMATION;

#endif

enum {
FILE_LINK_REPLACE_IF_EXISTS = 0x01,
FILE_LINK_POSIX_SEMANTICS = 0x02,
Expand Down
5 changes: 5 additions & 0 deletions winsup/cygwin/net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ details. */
#undef u_long
#define u_long __ms_u_long
#include <w32api/ws2tcpip.h>
/* 2025-06-09: win32api headers v13 now define a cmsghdr type which clashes with
our socket.h. Arrange not to see it here. */
#undef cmsghdr
#define cmsghdr __ms_cmsghdr
#include <w32api/mswsock.h>
#undef cmsghdr
#include <w32api/iphlpapi.h>
#define gethostname cygwin_gethostname
#include <unistd.h>
Expand Down
21 changes: 16 additions & 5 deletions winsup/cygwin/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2031,9 +2031,18 @@ symlink_native (const char *oldpath, path_conv &win32_newpath)
while (towupper (*++c_old) == towupper (*++c_new))
;
/* The last component could share a common prefix, so make sure we end
up on the first char after the last common backslash. */
while (c_old[-1] != L'\\')
--c_old, --c_new;
up on the first char after the last common backslash.

However, if c_old is a strict prefix of c_new (at a component
boundary), or vice versa, then do not try to find the last common
backslash. */
if ((!*c_old || *c_old == L'\\') && (!*c_new || *c_new == L'\\'))
c_old += !!*c_old, c_new += !!*c_new;
else
{
while (c_old[-1] != L'\\')
--c_old, --c_new;
}

/* 2. Check if prefix is long enough. The prefix must at least points to
a complete device: \\?\X:\ or \\?\UNC\server\share\ are the minimum
Expand All @@ -2058,8 +2067,10 @@ symlink_native (const char *oldpath, path_conv &win32_newpath)
final_oldpath = &final_oldpath_buf;
final_oldpath->Buffer = tp.w_get ();
PWCHAR e_old = final_oldpath->Buffer;
while (num-- > 0)
e_old = wcpcpy (e_old, L"..\\");
while (num > 1 || (num == 1 && *c_old))
e_old = wcpcpy (e_old, L"..\\"), num--;
if (num > 0)
e_old = wcpcpy (e_old, L"..");
wcpcpy (e_old, c_old);
}
}
Expand Down
Loading