diff options
-rw-r--r-- | src/firejail/appimage.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/firejail/appimage.c b/src/firejail/appimage.c index 7c60d9189..1da765d8f 100644 --- a/src/firejail/appimage.c +++ b/src/firejail/appimage.c | |||
@@ -126,16 +126,25 @@ void appimage_set(const char *appimage) { | |||
126 | printf("appimage mounted on %s\n", mntdir); | 126 | printf("appimage mounted on %s\n", mntdir); |
127 | EUID_USER(); | 127 | EUID_USER(); |
128 | 128 | ||
129 | char* abspath = realpath(appimage, NULL); | ||
130 | if (abspath == NULL) | ||
131 | errExit("Failed to obtain absolute path"); | ||
132 | |||
129 | // set environment | 133 | // set environment |
130 | if (setenv("APPIMAGE", appimage, 1) < 0) | 134 | if (setenv("APPIMAGE", abspath, 1) < 0) |
131 | errExit("setenv"); | 135 | errExit("setenv"); |
132 | if (mntdir && setenv("APPDIR", mntdir, 1) < 0) | 136 | if (mntdir && setenv("APPDIR", mntdir, 1) < 0) |
133 | errExit("setenv"); | 137 | errExit("setenv"); |
138 | if (size != 0 && setenv("ARGV0", appimage, 1) < 0) | ||
139 | errExit("setenv"); | ||
140 | if (setenv("OWD", cfg.cwd, 1) < 0) | ||
141 | errExit("setenv"); | ||
134 | 142 | ||
135 | // build new command line | 143 | // build new command line |
136 | if (asprintf(&cfg.command_line, "%s/AppRun", mntdir) == -1) | 144 | if (asprintf(&cfg.command_line, "%s/AppRun", mntdir) == -1) |
137 | errExit("asprintf"); | 145 | errExit("asprintf"); |
138 | 146 | ||
147 | free(abspath); | ||
139 | free(mode); | 148 | free(mode); |
140 | #ifdef HAVE_GCOV | 149 | #ifdef HAVE_GCOV |
141 | __gcov_flush(); | 150 | __gcov_flush(); |