Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
ba5c73b3
Commit
ba5c73b3
authored
Jun 24, 2014
by
Mark Andrews
Browse files
3886. [bug] rbtdb_write_header should use a once to initialize
FILE_VERSION. [RT #36374]
parent
1c95f672
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
ba5c73b3
3886. [bug] rbtdb_write_header should use a once to initialize
FILE_VERSION. [RT #36374]
3885. [port] Use 'open()' rather than 'file()' to open files in
python.
...
...
lib/dns/rbtdb.c
View file @
ba5c73b3
...
...
@@ -36,6 +36,7 @@
#include
<isc/hex.h>
#include
<isc/mem.h>
#include
<isc/mutex.h>
#include
<isc/once.h>
#include
<isc/platform.h>
#include
<isc/print.h>
#include
<isc/random.h>
...
...
@@ -7452,6 +7453,18 @@ rbtdb_zero_header(FILE *rbtfile) {
return
(
result
);
}
static
isc_once_t
once
=
ISC_ONCE_INIT
;
static
void
init_file_version
(
void
)
{
int
n
;
memset
(
FILE_VERSION
,
0
,
sizeof
(
FILE_VERSION
));
n
=
snprintf
(
FILE_VERSION
,
sizeof
(
FILE_VERSION
),
"RBTDB Image %s %s"
,
dns_major
,
dns_mapapi
);
INSIST
(
n
<
sizeof
(
FILE_VERSION
));
}
/*
* Write the file header out, recording the locations of the three
* RBT's used in the rbtdb: tree, nsec, and nsec3, and including NodeDump
...
...
@@ -7465,11 +7478,7 @@ rbtdb_write_header(FILE *rbtfile, off_t tree_location, off_t nsec_location,
rbtdb_file_header_t
header
;
isc_result_t
result
;
if
(
FILE_VERSION
[
0
]
==
'\0'
)
{
memset
(
FILE_VERSION
,
0
,
sizeof
(
FILE_VERSION
));
snprintf
(
FILE_VERSION
,
sizeof
(
FILE_VERSION
),
"RBTDB Image %s %s"
,
dns_major
,
dns_mapapi
);
}
RUNTIME_CHECK
(
isc_once_do
(
&
once
,
init_file_version
)
==
ISC_R_SUCCESS
);
memset
(
&
header
,
0
,
sizeof
(
rbtdb_file_header_t
));
memmove
(
header
.
version1
,
FILE_VERSION
,
sizeof
(
header
.
version1
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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