comparison dwcompat.h @ 2244:a1ac35abd5fd

Make sure domain socket paths have a trailing DIRSEP... fixes an issue on Windows 10. The NTFS junction used for domain sockets on Windows 10 were going into the directory above the TEMP directory due to a missing trailing directory separator.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 19 Jan 2021 16:36:58 +0000
parents 95ad22a4da2d
children 471cdeaef7ac
comparison
equal deleted inserted replaced
2243:8f9ffba67b7c 2244:a1ac35abd5fd
155 155
156 #ifndef BKS_TABBEDDIALOG 156 #ifndef BKS_TABBEDDIALOG
157 #define BKS_TABBEDDIALOG 0x0800 157 #define BKS_TABBEDDIALOG 0x0800
158 #endif 158 #endif
159 159
160 #define PIPEROOT "\\socket\\" 160 #define PIPEROOT "\\socket"
161 #endif /* __EMX__ || __IBMC__ */ 161 #endif /* __EMX__ || __IBMC__ */
162 162
163 #if defined(__OS2__) && (defined(__IBMC__) || defined(__WATCOMC__)) 163 #if defined(__OS2__) && (defined(__IBMC__) || defined(__WATCOMC__))
164 #define BSD_SELECT 164 #define BSD_SELECT
165 165
213 /* Cygwin and Visual Studio 15.4 (SDK 10.0.16299.15) support domain sockets */ 213 /* Cygwin and Visual Studio 15.4 (SDK 10.0.16299.15) support domain sockets */
214 #if defined(__CYGWIN32__) 214 #if defined(__CYGWIN32__)
215 #include <sys/un.h> 215 #include <sys/un.h>
216 #elif defined(_MSC_VER) && _MSC_VER >= 1912 216 #elif defined(_MSC_VER) && _MSC_VER >= 1912
217 #include <afunix.h> 217 #include <afunix.h>
218 #define PIPEROOT getenv("TEMP") ? getenv("TEMP") : "C:\\Windows\\Temp\\" 218 #define PIPEROOT getenv("TEMP") ? getenv("TEMP") : "C:\\Windows\\Temp"
219 #else 219 #else
220 #define NO_DOMAIN_SOCKETS 220 #define NO_DOMAIN_SOCKETS
221 #endif 221 #endif
222 222
223 #if defined(_P_NOWAIT) && !defined(P_NOWAIT) 223 #if defined(_P_NOWAIT) && !defined(P_NOWAIT)
307 #ifndef API 307 #ifndef API
308 #define API 308 #define API
309 #endif 309 #endif
310 310
311 #ifndef PIPEROOT 311 #ifndef PIPEROOT
312 #define PIPEROOT "/tmp/" 312 #define PIPEROOT "/tmp"
313 #endif 313 #endif
314 314
315 #define PIPENAME "%s" __TARGET__ "%d-%d" 315 #define PIPENAME "%s%s" __TARGET__ "%d-%d"
316 316
317 /* Compatibility layer for IBM C/Winsock 317 /* Compatibility layer for IBM C/Winsock
318 * Now using macros so we can allow cross 318 * Now using macros so we can allow cross
319 * compiler support. 319 * compiler support.
320 */ 320 */
405 pipes[0] = pipes[1] = -1; \ 405 pipes[0] = pipes[1] = -1; \
406 if(tmpsock > -1 && (pipes[1] = socket(AF_UNIX, SOCK_STREAM, 0)) > -1) \ 406 if(tmpsock > -1 && (pipes[1] = socket(AF_UNIX, SOCK_STREAM, 0)) > -1) \
407 { \ 407 { \
408 memset(&un, 0, sizeof(un)); \ 408 memset(&un, 0, sizeof(un)); \
409 un.sun_family=AF_UNIX; \ 409 un.sun_family=AF_UNIX; \
410 sprintf(un.sun_path, PIPENAME, PIPEROOT, (int)getpid(), pipes[1]); \ 410 sprintf(un.sun_path, PIPENAME, PIPEROOT, DIRSEP, (int)getpid(), pipes[1]); \
411 unlink(un.sun_path); \ 411 unlink(un.sun_path); \
412 bind(tmpsock, (struct sockaddr *)&un, sizeof(un)); \ 412 bind(tmpsock, (struct sockaddr *)&un, sizeof(un)); \
413 listen(tmpsock, 0); \ 413 listen(tmpsock, 0); \
414 connect(pipes[1], (struct sockaddr *)&un, sizeof(un)); \ 414 connect(pipes[1], (struct sockaddr *)&un, sizeof(un)); \
415 pipes[0] = accept(tmpsock, 0, 0); \ 415 pipes[0] = accept(tmpsock, 0, 0); \