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
9d045ca0
Commit
9d045ca0
authored
Feb 02, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where we used old clear_if_first when doing I/O in open.
Add more logging.
parent
c92d0d63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
ccan/tdb/test/run-open-during-transaction.c
ccan/tdb/test/run-open-during-transaction.c
+23
-4
No files found.
ccan/tdb/test/run-open-during-transaction.c
View file @
9d045ca0
...
...
@@ -41,6 +41,20 @@ static bool clear_if_first;
#undef fcntl
#undef ftruncate
static
void
taplog
(
struct
tdb_context
*
tdb
,
enum
tdb_debug_level
level
,
const
char
*
fmt
,
...)
{
va_list
ap
;
char
line
[
200
];
va_start
(
ap
,
fmt
);
vsprintf
(
line
,
fmt
,
ap
);
va_end
(
ap
);
diag
(
"%s"
,
line
);
}
static
void
save_file_contents
(
int
fd
)
{
struct
stat
st
;
...
...
@@ -195,6 +209,7 @@ static int ftruncate_check(int fd, off_t length)
int
main
(
int
argc
,
char
*
argv
[])
{
struct
tdb_logging_context
logctx
=
{
taplog
,
NULL
};
const
int
flags
[]
=
{
TDB_DEFAULT
,
TDB_CLEAR_IF_FIRST
,
TDB_NOMMAP
,
...
...
@@ -213,11 +228,15 @@ int main(int argc, char *argv[])
nice
(
15
);
for
(
i
=
0
;
i
<
sizeof
(
flags
)
/
sizeof
(
flags
[
0
]);
i
++
)
{
clear_if_first
=
(
flags
[
i
]
&
TDB_CLEAR_IF_FIRST
);
diag
(
"Test with %s and %s
\n
"
,
clear_if_first
?
"CLEAR"
:
"DEFAULT"
,
(
flags
[
i
]
&
TDB_NOMMAP
)
?
"no mmap"
:
"mmap"
);
unlink
(
TEST_DBNAME
);
tdb
=
tdb_open
(
TEST_DBNAME
,
1024
,
flags
[
i
],
O_CREAT
|
O_TRUNC
|
O_RDWR
,
0600
);
tdb
=
tdb_open_ex
(
TEST_DBNAME
,
1024
,
flags
[
i
],
O_CREAT
|
O_TRUNC
|
O_RDWR
,
0600
,
&
logctx
,
NULL
);
ok1
(
tdb
);
clear_if_first
=
(
flags
[
i
]
&
TDB_CLEAR_IF_FIRST
);
ok1
(
tdb_transaction_start
(
tdb
)
==
0
);
in_transaction
=
true
;
...
...
@@ -230,7 +249,7 @@ int main(int argc, char *argv[])
ok1
(
tdb_transaction_commit
(
tdb
)
==
0
);
if
(
agent_pending
)
check_for_agent
(
tdb
->
fd
,
true
);
ok
(
errors
==
0
,
"We had %u
error
s"
,
errors
);
ok
(
errors
==
0
,
"We had %u
unexpected change
s"
,
errors
);
tdb_close
(
tdb
);
}
...
...
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