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
812391f1
Commit
812391f1
authored
Mar 17, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: avoid writing uninitialized bytes in test/layout.c
parent
2b5cb9bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
ccan/tdb2/test/layout.c
ccan/tdb2/test/layout.c
+2
-0
ccan/tdb2/test/run-03-coalesce.c
ccan/tdb2/test/run-03-coalesce.c
+5
-5
No files found.
ccan/tdb2/test/layout.c
View file @
812391f1
...
...
@@ -252,6 +252,8 @@ struct tdb_context *tdb_layout_get(struct tdb_layout *layout)
}
mem
=
malloc
(
off
);
/* Fill with some weird pattern. */
memset
(
mem
,
0x99
,
off
);
/* Now populate our header, cribbing from a real TDB header. */
tdb
=
tdb_open
(
NULL
,
TDB_INTERNAL
,
O_RDWR
,
0
,
&
tap_log_attr
);
memcpy
(
mem
,
tdb
->
map_ptr
,
sizeof
(
struct
tdb_header
));
...
...
ccan/tdb2/test/run-03-coalesce.c
View file @
812391f1
...
...
@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
key
.
dsize
=
5
;
/* No coalescing can be done due to EOF */
layout
=
new_tdb_layout
(
NULL
);
layout
=
new_tdb_layout
(
"run-03-coalesce.tdb"
);
tdb_layout_add_freetable
(
layout
);
len
=
1024
;
tdb_layout_add_free
(
layout
,
len
,
0
);
...
...
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
tdb_layout_free
(
layout
);
/* No coalescing can be done due to used record */
layout
=
new_tdb_layout
(
NULL
);
layout
=
new_tdb_layout
(
"run-03-coalesce.tdb"
);
tdb_layout_add_freetable
(
layout
);
tdb_layout_add_free
(
layout
,
1024
,
0
);
tdb_layout_add_used
(
layout
,
key
,
data
,
6
);
...
...
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
tdb_layout_free
(
layout
);
/* Coalescing can be done due to two free records, then EOF */
layout
=
new_tdb_layout
(
NULL
);
layout
=
new_tdb_layout
(
"run-03-coalesce.tdb"
);
tdb_layout_add_freetable
(
layout
);
tdb_layout_add_free
(
layout
,
1024
,
0
);
tdb_layout_add_free
(
layout
,
2048
,
0
);
...
...
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
tdb_layout_free
(
layout
);
/* Coalescing can be done due to two free records, then data */
layout
=
new_tdb_layout
(
NULL
);
layout
=
new_tdb_layout
(
"run-03-coalesce.tdb"
);
tdb_layout_add_freetable
(
layout
);
tdb_layout_add_free
(
layout
,
1024
,
0
);
tdb_layout_add_free
(
layout
,
512
,
0
);
...
...
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
tdb_layout_free
(
layout
);
/* Coalescing can be done due to three free records, then EOF */
layout
=
new_tdb_layout
(
NULL
);
layout
=
new_tdb_layout
(
"run-03-coalesce.tdb"
);
tdb_layout_add_freetable
(
layout
);
tdb_layout_add_free
(
layout
,
1024
,
0
);
tdb_layout_add_free
(
layout
,
512
,
0
);
...
...
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