Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
95c98eb3
Commit
95c98eb3
authored
Mar 17, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: check for invalid flags in tdb_open.
This is vitally important for forwards compatibility.
parent
0cbedc52
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
ccan/tdb2/doc/design.lyx
ccan/tdb2/doc/design.lyx
+6
-0
ccan/tdb2/tdb.c
ccan/tdb2/tdb.c
+7
-0
No files found.
ccan/tdb2/doc/design.lyx
View file @
95c98eb3
...
@@ -785,9 +785,15 @@ Status
...
@@ -785,9 +785,15 @@ Status
\end_layout
\end_layout
\begin_layout Standard
\begin_layout Standard
\change_deleted 0 1300360559
Incomplete.
Incomplete.
TDB_VOLATILE still defined, but implementation should fail on unknown flags
TDB_VOLATILE still defined, but implementation should fail on unknown flags
to be future-proof.
to be future-proof.
\change_inserted 0 1300360588
Complete.
Unknown flags cause tdb_open() to fail as well, so they can be detected
at runtime.
\end_layout
\end_layout
\begin_layout Subsection
\begin_layout Subsection
...
...
ccan/tdb2/tdb.c
View file @
95c98eb3
...
@@ -237,6 +237,13 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
...
@@ -237,6 +237,13 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
attr
=
attr
->
base
.
next
;
attr
=
attr
->
base
.
next
;
}
}
if
(
tdb_flags
&
~
(
TDB_INTERNAL
|
TDB_NOLOCK
|
TDB_NOMMAP
|
TDB_CONVERT
|
TDB_NOSYNC
))
{
ecode
=
tdb_logerr
(
tdb
,
TDB_ERR_EINVAL
,
TDB_LOG_USE_ERROR
,
"tdb_open: unknown flags %u"
,
tdb_flags
);
goto
fail
;
}
if
((
open_flags
&
O_ACCMODE
)
==
O_WRONLY
)
{
if
((
open_flags
&
O_ACCMODE
)
==
O_WRONLY
)
{
ecode
=
tdb_logerr
(
tdb
,
TDB_ERR_EINVAL
,
TDB_LOG_USE_ERROR
,
ecode
=
tdb_logerr
(
tdb
,
TDB_ERR_EINVAL
,
TDB_LOG_USE_ERROR
,
"tdb_open: can't open tdb %s write-only"
,
"tdb_open: can't open tdb %s write-only"
,
...
...
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