Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
07b14dd8
Commit
07b14dd8
authored
Jul 26, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add locking where it exists
parent
ef38b78f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
Modules/dbhashmodule.c
Modules/dbhashmodule.c
+16
-5
No files found.
Modules/dbhashmodule.c
View file @
07b14dd8
...
...
@@ -334,19 +334,30 @@ dbhashopen(self, args)
return
NULL
;
if
(
flag
!=
NULL
)
{
/* XXX need a way to pass O_EXCL, O_EXLOCK, O_NONBLOCK, O_SHLOCK */
if
(
strcmp
(
flag
,
"r"
)
==
0
)
if
(
flag
[
0
]
==
'r'
)
flags
=
O_RDONLY
;
else
if
(
strcmp
(
flag
,
"w"
)
==
0
)
else
if
(
flag
[
0
]
==
'w'
)
flags
=
O_RDWR
;
else
if
(
strcmp
(
flag
,
"c"
)
==
0
)
else
if
(
flag
[
0
]
==
'c'
)
flags
=
O_RDWR
|
O_CREAT
;
else
if
(
strcmp
(
flag
,
"n"
)
==
0
)
else
if
(
flag
[
0
]
==
'n'
)
flags
=
O_RDWR
|
O_CREAT
|
O_TRUNC
;
else
{
err_setstr
(
DbhashError
,
"Flag should be
one of
'r', 'w', 'c' or 'n'"
);
"Flag should be
gin with
'r', 'w', 'c' or 'n'"
);
return
NULL
;
}
if
(
flag
[
1
]
==
'l'
)
{
#if defined(O_EXLOCK) && defined(O_SHLOCK)
if
(
flag
[
0
]
==
'r'
)
flags
|=
O_SHLOCK
;
else
flags
|=
O_EXLOCK
;
#else
err_setstr
(
DbhashError
,
"locking not supported on this platform"
);
return
NULL
;
#endif
}
}
return
newdbhashobject
(
file
,
flags
,
mode
,
bsize
,
ffactor
,
nelem
,
cachesize
,
hash
,
lorder
);
...
...
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