Skip to content

Commit

Permalink
load-service: throw an error if the "consumer" service is its own con…
Browse files Browse the repository at this point in the history
…sumer

In the past, the dinitctl command to start that service would just hang and
dinit would mark that service as STOPPED without any reason in its reports.

Signed-off-by: Mobin "Hojjat" Aydinfar <[email protected]>
Reviewed-by: Davin McCall <EMAIL HIDDEN>
  • Loading branch information
mobin-2008 committed Aug 27, 2023
1 parent 0e727cf commit 48dac91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/includes/load-service.h
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,10 @@ void process_service_line(settings_wrapper &settings, const char *name, string &
}
else if (setting == "consumer-of") {
string consumed_svc_name = read_setting_value(line_num, i, end);
if (consumed_svc_name == name) {
throw service_description_exc(name, "service cannot be its own consumer",
line_num);
}
settings.consumer_of_name = consumed_svc_name;
}
else if (setting == "restart") {
Expand Down

0 comments on commit 48dac91

Please sign in to comment.