Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
eb5c8733
Commit
eb5c8733
authored
Oct 22, 2019
by
Simon Spannagel
Browse files
Core: protect detectors_file_updated by deny_overwrite
parent
832f7815
Pipeline
#1170091
passed with stages
in 14 minutes and 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/core/module/ModuleManager.cpp
View file @
eb5c8733
...
...
@@ -710,11 +710,19 @@ void ModuleManager::finaliseAll() {
// Write out update detectors file:
if
(
global_config
.
has
(
"detectors_file_updated"
))
{
std
::
string
file_name
=
global_config
.
getPath
(
"detectors_file_updated"
);
std
::
string
path
=
global_config
.
getPath
(
"detectors_file_updated"
);
// Check if the file exists
std
::
ofstream
file
(
file_name
);
if
(
corryvreckan
::
path_is_file
(
path
))
{
if
(
global_config
.
get
<
bool
>
(
"deny_overwrite"
,
false
))
{
throw
RuntimeError
(
"Overwriting of existing detectors file "
+
path
+
" denied"
);
}
LOG
(
WARNING
)
<<
"Detectors file "
<<
path
<<
" exists and will be overwritten."
;
corryvreckan
::
remove_file
(
path
);
}
std
::
ofstream
file
(
path
);
if
(
!
file
)
{
throw
ConfigFileUnavailableError
(
file_name
);
throw
RuntimeError
(
"Cannot create detectors file "
+
path
);
}
ConfigReader
final_detectors
;
...
...
@@ -723,7 +731,7 @@ void ModuleManager::finaliseAll() {
}
final_detectors
.
write
(
file
);
LOG
(
STATUS
)
<<
"Wrote updated detector configuration to "
<<
file_name
;
LOG
(
STATUS
)
<<
"Wrote updated detector configuration to "
<<
path
;
}
// Check the timing for all events
...
...
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