Skip to content

Commit

Permalink
Treat unreadable service files as invalid
Browse files Browse the repository at this point in the history
This is a followup to a0869bd.
If we return 0 the parsing is considered complete and bad things
happen in manager_load_service_file.
  • Loading branch information
yaneti committed Jan 22, 2019
1 parent bd1e9eb commit 0f91a09
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/launch/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ static int manager_ini_reader_parse_file(CIniGroup **groupp, const char *path) {
fprintf(stderr, "Unable to open service file '%s' (%d): %m\n", path, errno);

*groupp = NULL;
return 0;
return MANAGER_E_INVALID_SERVICE_FILE;
}

r = c_ini_reader_new(&reader);
Expand Down Expand Up @@ -948,8 +948,12 @@ static int manager_load_service_file(Manager *manager, const char *path, NSSCach
int r;

r = manager_ini_reader_parse_file(&group, path);
if (r)
if (r) {
if (r == MANAGER_E_INVALID_SERVICE_FILE)
return r;

return error_trace(r);
}

name_entry = c_ini_group_find(group, "Name", -1);
unit_entry = c_ini_group_find(group, "SystemdService", -1);
Expand Down

0 comments on commit 0f91a09

Please sign in to comment.