Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
defunctec
crown-core
Commits
9a846d21
Commit
9a846d21
authored
12 years ago
by
Wladimir J. van der Laan
Browse files
Options
Download
Plain Diff
Merge pull request #1921 from laanwj/2012_10_init_useafterfree
Fix a use-after-free problem in initialization (#1920)
parents
08ca520a
212eb963
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/init.cpp
+6
-6
src/init.cpp
with
6 additions
and
6 deletions
+6
-6
src/init.cpp
View file @
9a846d21
...
...
@@ -440,7 +440,7 @@ bool AppInit2()
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
const
char
*
psz
DataDir
=
GetDataDir
().
string
()
.
c_str
()
;
std
::
string
str
DataDir
=
GetDataDir
().
string
();
// Make sure only a single Bitcoin process is using the data directory.
boost
::
filesystem
::
path
pathLockFile
=
GetDataDir
()
/
".lock"
;
...
...
@@ -448,7 +448,7 @@ bool AppInit2()
if
(
file
)
fclose
(
file
);
static
boost
::
interprocess
::
file_lock
lock
(
pathLockFile
.
string
().
c_str
());
if
(
!
lock
.
try_lock
())
return
InitError
(
strprintf
(
_
(
"Cannot obtain a lock on data directory %s. Bitcoin is probably already running."
),
psz
DataDir
));
return
InitError
(
strprintf
(
_
(
"Cannot obtain a lock on data directory %s. Bitcoin is probably already running."
),
str
DataDir
.
c_str
()
));
#if !defined(WIN32) && !defined(QT_GUI)
if
(
fDaemon
)
...
...
@@ -480,7 +480,7 @@ bool AppInit2()
if
(
!
fLogTimestamps
)
printf
(
"Startup time: %s
\n
"
,
DateTimeStrFormat
(
"%x %H:%M:%S"
,
GetTime
()).
c_str
());
printf
(
"Default data directory %s
\n
"
,
GetDefaultDataDir
().
string
().
c_str
());
printf
(
"Used data directory %s
\n
"
,
psz
DataDir
);
printf
(
"Used data directory %s
\n
"
,
str
DataDir
.
c_str
()
);
std
::
ostringstream
strErrors
;
if
(
fDaemon
)
...
...
@@ -496,7 +496,7 @@ bool AppInit2()
{
string
msg
=
strprintf
(
_
(
"Error initializing database environment %s!"
" To recover, BACKUP THAT DIRECTORY, then remove"
" everything from it except for wallet.dat."
),
psz
DataDir
);
" everything from it except for wallet.dat."
),
str
DataDir
.
c_str
()
);
return
InitError
(
msg
);
}
...
...
@@ -515,7 +515,7 @@ bool AppInit2()
string
msg
=
strprintf
(
_
(
"Warning: wallet.dat corrupt, data salvaged!"
" Original wallet.dat saved as wallet.{timestamp}.bak in %s; if"
" your balance or transactions are incorrect you should"
" restore from a backup."
),
psz
DataDir
);
" restore from a backup."
),
str
DataDir
.
c_str
()
);
uiInterface
.
ThreadSafeMessageBox
(
msg
,
_
(
"Bitcoin"
),
CClientUIInterface
::
OK
|
CClientUIInterface
::
ICON_EXCLAMATION
|
CClientUIInterface
::
MODAL
);
}
if
(
r
==
CDBEnv
::
RECOVER_FAIL
)
...
...
@@ -634,7 +634,7 @@ bool AppInit2()
{
string
msg
=
strprintf
(
_
(
"Error initializing database environment %s!"
" To recover, BACKUP THAT DIRECTORY, then remove"
" everything from it except for wallet.dat."
),
psz
DataDir
);
" everything from it except for wallet.dat."
),
str
DataDir
.
c_str
()
);
return
InitError
(
msg
);
}
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help