Skip to content

Commit 839a6c8

Browse files
Refactoring
1 parent 16ff241 commit 839a6c8

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

launcher/main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,24 @@ LIPCcode go_callback(LIPC* lipc, const char* property, void* value, void* data)
117117
strcat(command, "\"");
118118

119119
if (useHooks) { // useHooks script - source it and use `on_run`
120-
commandLength = strlen("sh -c \"source \\\"") + escapedPathLength + strlen("\\\"; on_run;\"");
121120
free(command);
121+
commandLength = strlen("sh -c \"source \\\"") + escapedPathLength + strlen("\\\"; on_run;\"");
122122
command = malloc(commandLength);
123123
command[0] = '\0';
124124
strcat(command, "sh -c \"source \\\"");
125125
strcat(command, escapedPath);
126126
strcat(command, "\\\"; on_run;\"");
127127
}
128128
if (useFBInk) {
129-
commandLength = strlen("/mnt/us/libkh/bin/fbink -k; ") + escapedPathLength + strlen(" 2>&1 | /mnt/us/libkh/bin/fbink -y 5 -r");
129+
char* old_command = strdup(command);
130130
free(command);
131+
commandLength = strlen("/mnt/us/libkh/bin/fbink -k; ") + strlen(old_command) + strlen(" 2>&1 | /mnt/us/libkh/bin/fbink -y 5 -r");
131132
command = malloc(commandLength);
132133
command[0] = '\0';
133134
strcat(command, "/mnt/us/libkh/bin/fbink -k; ");
134-
strcat(command, escapedPath);
135+
strcat(command, old_command);
135136
strcat(command, " 2>&1 | /mnt/us/libkh/bin/fbink -y 5 -r");
137+
free(old_command);
136138
}
137139

138140
syslog(LOG_INFO, "Invoking app using \"%s\"", command);

0 commit comments

Comments
 (0)