Skip to content

Commit

Permalink
load-service: Throw an error on invalid value for "restart" and "smoo…
Browse files Browse the repository at this point in the history
…th-recovery"

Signed-off-by: Mobin Aydinfar <[email protected]>
  • Loading branch information
mobin-2008 committed Sep 16, 2024
1 parent 16d90ca commit 87f8318
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/includes/load-service.h
Original file line number Diff line number Diff line change
Expand Up @@ -1644,15 +1644,28 @@ void process_service_line(settings_wrapper &settings, const char *name, string &
else if (restart == "on-failure") {
settings.auto_restart = auto_restart_mode::ON_FAILURE;
}
else {
else if (restart == "no" || restart == "false") {
settings.auto_restart = auto_restart_mode::NEVER;
}
else {
throw service_description_exc(name, "restart must be one of: \"yes\", \"true\","
" \"no\", \"false\" or \"on-failure\"", "restart", input_pos);
}
break;
}
case setting_id_t::SMOOTH_RECOVERY:
{
string recovery = read_setting_value(input_pos, i, end);
settings.smooth_recovery = (recovery == "yes" || recovery == "true");
if (recovery == "yes" || recovery == "true") {
settings.smooth_recovery = true;
}
else if (recovery == "no" || recovery == "false") {
settings.smooth_recovery = false;
}
else {
throw service_description_exc(name, "smooth-recovery must be one of: \"yes\","
" \"true\", \"no\" or \"false\"", "smooth-recovery", input_pos);
}
break;
}
case setting_id_t::TYPE:
Expand Down

0 comments on commit 87f8318

Please sign in to comment.