--- sbbs/src/sbbs3/nopen.c 2018/04/24 16:41:23 1.1.1.1 +++ sbbs/src/sbbs3/nopen.c 2018/04/24 16:43:06 1.1.1.2 @@ -2,13 +2,13 @@ /* Network open functions (nopen and fnopen) */ -/* $Id: nopen.c,v 1.1.1.1 2018/04/24 16:41:23 root Exp $ */ +/* $Id: nopen.c,v 1.1.1.2 2018/04/24 16:43:06 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -39,9 +39,10 @@ #include "crc32.h" /****************************************************************************/ -/* Network open function. Opens all files DENYALL and retries LOOP_NOPEN */ -/* number of times if the attempted file is already open or denying access */ -/* for some other reason. All files are opened in BINARY mode. */ +/* Network open function. Opens all files DENYALL, DENYWRITE, or DENYNONE */ +/* depending on access, and retries LOOP_NOPEN number of times if the */ +/* attempted file is already open or denying access for some other reason. */ +/* All files are opened in BINARY mode. */ /****************************************************************************/ int nopen(const char* str, int access) { @@ -60,19 +61,20 @@ int nopen(const char* str, int access) if(!(access&O_TEXT)) access|=O_BINARY; #endif - while(((file=sopen(str,access,share,S_IREAD|S_IWRITE))==-1) + while(((file=sopen(str,access,share,DEFFILEMODE))==-1) && (errno==EACCES || errno==EAGAIN || errno==EDEADLOCK) && count++