Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
b99ac059
Commit
b99ac059
authored
Apr 29, 2003
by
rswindell
Browse files
Using correct prototype for sopen() - including pmode when used with O_CREAT.
parent
16368def
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
20 deletions
+16
-20
src/xpdev/filewrap.c
src/xpdev/filewrap.c
+12
-11
src/xpdev/filewrap.h
src/xpdev/filewrap.h
+4
-9
No files found.
src/xpdev/filewrap.c
View file @
b99ac059
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
2
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
3
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
...
...
@@ -152,25 +152,26 @@ int DLLCALL unlock(int fd, long pos, int len)
}
/* Opens a file in specified sharing (file-locking) mode */
#ifdef __QNX__
int
DLLCALL
qnx_sopen
(
char
*
fn
,
int
access
,
int
share
)
{
#undef sopen
/* Stupid macro trick */
return
(
sopen
(
fn
,
access
,
share
,
S_IREAD
|
S_IWRITE
));
#define sopen(x,y,z) qnx_sopen(x,y,z)
}
#else
int
DLLCALL
sopen
(
char
*
fn
,
int
access
,
int
share
)
#if !defined(__QNX__)
int
DLLCALL
sopen
(
const
char
*
fn
,
int
access
,
int
share
,
...)
{
int
fd
;
int
pmode
=
S_IREAD
;
#ifndef F_SANEWRLCKNO
int
flock_op
=
LOCK_NB
;
/* non-blocking */
#endif
#if defined(F_SANEWRLCKNO) || !defined(BSD)
struct
flock
alock
;
#endif
va_list
ap
;
if
(
access
&
O_CREAT
)
{
va_start
(
ap
,
share
);
pmode
=
va_arg
(
ap
,
unsigned
int
));
va_end
(
ap
);
}
if
((
fd
=
open
(
fn
,
access
,
S_IREAD
|
S_IWRITE
))
<
0
)
if
((
fd
=
open
(
fn
,
access
,
pmode
))
<
0
)
return
-
1
;
if
(
share
==
SH_DENYNO
)
/* no lock needed */
...
...
src/xpdev/filewrap.h
View file @
b99ac059
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
2
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
3
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
...
...
@@ -59,9 +59,6 @@
#include <windows.h>
/* OF_SHARE_ */
#include <share.h>
/* SH_DENY */
#define sopen(f,o,s) _sopen(f,o,s,S_IREAD|S_IWRITE)
#define close(f) _close(f)
#ifndef SH_DENYNO
#define SH_DENYNO OF_SHARE_DENY_NONE
#define SH_DENYWR OF_SHARE_DENY_WRITE
...
...
@@ -122,11 +119,9 @@ extern "C" {
#endif
#if !defined(__BORLANDC__) && defined(__unix__)
#if defined(__QNX__)
DLLEXPORT
int
DLLCALL
qnx_sopen
(
char
*
fn
,
int
access
,
int
share
);
#else
DLLEXPORT
int
DLLCALL
sopen
(
char
*
fn
,
int
access
,
int
share
);
#endif
/* !QNX */
#if !defined(__QNX__)
DLLEXPORT
int
DLLCALL
sopen
(
const
char
*
fn
,
int
access
,
int
share
,
...);
#endif
DLLEXPORT
long
DLLCALL
filelength
(
int
fd
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment