Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
ff624075
Commit
ff624075
authored
Jan 02, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage/State: check if a CompositeStorage exists; fixes nullptr dereference
Fixes another crash bug caused by commit
64d141f7
parent
08db2846
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
NEWS
NEWS
+3
-0
StorageState.cxx
src/storage/StorageState.cxx
+12
-0
No files found.
NEWS
View file @
ff624075
ver 0.20.15 (not yet released)
ver 0.20.15 (not yet released)
* state file
- make mount point restore errors non-fatal
- fix crash when restoring mounts with incompatible database plugin
ver 0.20.14 (2018/01/01)
ver 0.20.14 (2018/01/01)
* database
* database
...
...
src/storage/StorageState.cxx
View file @
ff624075
...
@@ -48,6 +48,9 @@ static constexpr Domain storage_domain("storage");
...
@@ -48,6 +48,9 @@ static constexpr Domain storage_domain("storage");
void
void
storage_state_save
(
BufferedOutputStream
&
os
,
const
Instance
&
instance
)
storage_state_save
(
BufferedOutputStream
&
os
,
const
Instance
&
instance
)
{
{
if
(
instance
.
storage
==
nullptr
)
return
;
const
auto
visitor
=
[
&
os
](
const
char
*
mount_uri
,
const
Storage
&
storage
)
{
const
auto
visitor
=
[
&
os
](
const
char
*
mount_uri
,
const
Storage
&
storage
)
{
std
::
string
uri
=
storage
.
MapUTF8
(
""
);
std
::
string
uri
=
storage
.
MapUTF8
(
""
);
if
(
uri
.
empty
()
||
StringIsEmpty
(
mount_uri
))
if
(
uri
.
empty
()
||
StringIsEmpty
(
mount_uri
))
...
@@ -85,6 +88,12 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
...
@@ -85,6 +88,12 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
FormatError
(
storage_domain
,
"Unrecognized line in mountpoint state: %s"
,
line
);
FormatError
(
storage_domain
,
"Unrecognized line in mountpoint state: %s"
,
line
);
}
}
if
(
instance
.
storage
==
nullptr
)
/* without storage (a CompositeStorage instance), we
cannot mount, and therefore we silently ignore the
state file */
return
true
;
if
(
url
.
empty
()
||
uri
.
empty
())
{
if
(
url
.
empty
()
||
uri
.
empty
())
{
LogError
(
storage_domain
,
"Missing value in mountpoint state."
);
LogError
(
storage_domain
,
"Missing value in mountpoint state."
);
return
true
;
return
true
;
...
@@ -120,6 +129,9 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
...
@@ -120,6 +129,9 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
unsigned
unsigned
storage_state_get_hash
(
const
Instance
&
instance
)
storage_state_get_hash
(
const
Instance
&
instance
)
{
{
if
(
instance
.
storage
==
nullptr
)
return
0
;
std
::
set
<
std
::
string
>
mounts
;
std
::
set
<
std
::
string
>
mounts
;
const
auto
visitor
=
[
&
mounts
](
const
char
*
mount_uri
,
const
Storage
&
storage
)
{
const
auto
visitor
=
[
&
mounts
](
const
char
*
mount_uri
,
const
Storage
&
storage
)
{
...
...
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