From 3080568a9c57adb381d44a33917f6254adc794b6 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sun, 2 Jan 2005 02:38:43 +0000 Subject: [PATCH] Bugfix: nopen() would open a file deny-all if O_BINARY was included (on Win32) in the access mask. This problem was evident in the FTP server not allowing simultaneous downloads of the same file. --- src/sbbs3/nopen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sbbs3/nopen.c b/src/sbbs3/nopen.c index 0a04b854e3..0701fad391 100644 --- a/src/sbbs3/nopen.c +++ b/src/sbbs3/nopen.c @@ -50,10 +50,13 @@ int nopen(const char* str, int access) if(access&O_DENYNONE) { share=SH_DENYNO; access&=~O_DENYNONE; } - else if(access==O_RDONLY) share=SH_DENYWR; + else if((access&~O_BINARY)==O_RDONLY) share=SH_DENYWR; else share=SH_DENYRW; + +#if !defined(__unix__) /* Basically, a no-op on Unix anyway */ if(!(access&O_TEXT)) access|=O_BINARY; +#endif while(((file=sopen(str,access,share,S_IREAD|S_IWRITE))==-1) && (errno==EACCES || errno==EAGAIN || errno==EDEADLOCK) && count++<LOOP_NOPEN) if(count) -- GitLab