Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/systemd-sonic-generator/systemd-sonic-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ static int get_install_targets_from_line(char* target_string, char* install_type
char final_target[PATH_MAX];
int num_targets = 0;

assert(target_string);
assert(install_type);

while ((token = strtok_r(target_string, " ", &target_string))) {
if (num_targets + existing_targets >= MAX_NUM_TARGETS) {
fputs("Number of targets found exceeds MAX_NUM_TARGETS\n", stderr);
Expand Down Expand Up @@ -269,7 +272,7 @@ int get_install_targets(char* unit_file, char* targets[]) {
char* token;
char* line = NULL;
bool first;
char* target_suffix;
char* target_suffix = NULL;
char *instance_name;
char *dot_ptr;

Expand Down Expand Up @@ -306,6 +309,8 @@ int get_install_targets(char* unit_file, char* targets[]) {
}
else if (strstr(token, "WantedBy") != NULL) {
target_suffix = ".wants";
} else {
break;
}
}
else {
Expand Down
1 change: 1 addition & 0 deletions src/systemd-sonic-generator/tests/testfiles/test.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/test.sh start
[Install]
Alias=test.service
WantedBy=multi-user.target