diff options
Diffstat (limited to 'src/firejail/macros.c')
-rw-r--r-- | src/firejail/macros.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/firejail/macros.c b/src/firejail/macros.c index 4bf3d3589..59b5db3d8 100644 --- a/src/firejail/macros.c +++ b/src/firejail/macros.c | |||
@@ -192,9 +192,8 @@ char *resolve_macro(const char *name) { | |||
192 | // directory (supplied). | 192 | // directory (supplied). |
193 | // The return value is allocated using malloc and must be freed by the caller. | 193 | // The return value is allocated using malloc and must be freed by the caller. |
194 | // The function returns NULL if there are any errors. | 194 | // The function returns NULL if there are any errors. |
195 | char *expand_home(const char *path, const char *homedir) { | 195 | char *expand_macros(const char *path) { |
196 | assert(path); | 196 | assert(path); |
197 | assert(homedir); | ||
198 | 197 | ||
199 | int called_as_root = 0; | 198 | int called_as_root = 0; |
200 | 199 | ||
@@ -210,14 +209,14 @@ char *expand_home(const char *path, const char *homedir) { | |||
210 | // Replace home macro | 209 | // Replace home macro |
211 | char *new_name = NULL; | 210 | char *new_name = NULL; |
212 | if (strncmp(path, "${HOME}", 7) == 0) { | 211 | if (strncmp(path, "${HOME}", 7) == 0) { |
213 | if (asprintf(&new_name, "%s%s", homedir, path + 7) == -1) | 212 | if (asprintf(&new_name, "%s%s", cfg.homedir, path + 7) == -1) |
214 | errExit("asprintf"); | 213 | errExit("asprintf"); |
215 | if(called_as_root) | 214 | if(called_as_root) |
216 | EUID_ROOT(); | 215 | EUID_ROOT(); |
217 | return new_name; | 216 | return new_name; |
218 | } | 217 | } |
219 | else if (*path == '~') { | 218 | else if (*path == '~') { |
220 | if (asprintf(&new_name, "%s%s", homedir, path + 1) == -1) | 219 | if (asprintf(&new_name, "%s%s", cfg.homedir, path + 1) == -1) |
221 | errExit("asprintf"); | 220 | errExit("asprintf"); |
222 | if(called_as_root) | 221 | if(called_as_root) |
223 | EUID_ROOT(); | 222 | EUID_ROOT(); |