diff options
author | smitsohu <smitsohu@gmail.com> | 2018-05-04 19:51:39 +0200 |
---|---|---|
committer | smitsohu <smitsohu@gmail.com> | 2018-05-04 19:51:39 +0200 |
commit | 99e8536770c79884dfd6b7d05ba669e5e382231e (patch) | |
tree | 62aa54039488e7e9d95c4965d61494cdb641bf65 /src | |
parent | enhance post-mount checks (diff) | |
download | firejail-99e8536770c79884dfd6b7d05ba669e5e382231e.tar.gz firejail-99e8536770c79884dfd6b7d05ba669e5e382231e.tar.zst firejail-99e8536770c79884dfd6b7d05ba669e5e382231e.zip |
get error handling right
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/pulseaudio.c | 6 | ||||
-rw-r--r-- | src/firejail/x11.c | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/firejail/pulseaudio.c b/src/firejail/pulseaudio.c index a7a1c3acc..a3ba6184f 100644 --- a/src/firejail/pulseaudio.c +++ b/src/firejail/pulseaudio.c | |||
@@ -178,10 +178,14 @@ void pulseaudio_init(void) { | |||
178 | 178 | ||
179 | // check /proc/self/mountinfo to confirm the mount is ok | 179 | // check /proc/self/mountinfo to confirm the mount is ok |
180 | MountData *mptr = get_last_mount(); | 180 | MountData *mptr = get_last_mount(); |
181 | if (strncmp(mptr->fstype, "tmpfs", 5) != 0 || strncmp(mptr->dir, homeusercfg, strlen(homeusercfg)) != 0) { | 181 | if (strncmp(mptr->dir, homeusercfg, strlen(homeusercfg)) != 0) { |
182 | fprintf(stderr, "Error: invalid mount on top of %s (should be %s)\n", mptr->dir, homeusercfg); | 182 | fprintf(stderr, "Error: invalid mount on top of %s (should be %s)\n", mptr->dir, homeusercfg); |
183 | exit(1); | 183 | exit(1); |
184 | } | 184 | } |
185 | if (strncmp(mptr->fstype, "tmpfs", 5) != 0) { | ||
186 | fprintf(stderr, "Error: invalid mount on top of %s (filesystem type is %s)\n", mptr->dir, mptr->fstype); | ||
187 | exit(1); | ||
188 | } | ||
185 | 189 | ||
186 | char *p; | 190 | char *p; |
187 | if (asprintf(&p, "%s/client.conf", homeusercfg) == -1) | 191 | if (asprintf(&p, "%s/client.conf", homeusercfg) == -1) |
diff --git a/src/firejail/x11.c b/src/firejail/x11.c index 554035c60..853bde43d 100644 --- a/src/firejail/x11.c +++ b/src/firejail/x11.c | |||
@@ -1196,11 +1196,14 @@ void x11_xorg(void) { | |||
1196 | 1196 | ||
1197 | // check /proc/self/mountinfo to confirm the mount is ok | 1197 | // check /proc/self/mountinfo to confirm the mount is ok |
1198 | MountData *mptr = get_last_mount(); | 1198 | MountData *mptr = get_last_mount(); |
1199 | if (strncmp(mptr->fstype, "tmpfs", 5) != 0 || strncmp(mptr->dir, dest, strlen(dest)) != 0) { | 1199 | if (strncmp(mptr->dir, dest, strlen(dest)) != 0) { |
1200 | fprintf(stderr, "Error: invalid mount on top of %s (should be %s)\n", mptr->dir, dest); | 1200 | fprintf(stderr, "Error: invalid mount on top of %s (should be %s)\n", mptr->dir, dest); |
1201 | exit(1); | 1201 | exit(1); |
1202 | } | 1202 | } |
1203 | 1203 | if (strncmp(mptr->fstype, "tmpfs", 5) != 0) { | |
1204 | fprintf(stderr, "Error: invalid mount on top of %s (filesystem type is %s)\n", mptr->dir, mptr->fstype); | ||
1205 | exit(1); | ||
1206 | } | ||
1204 | free(dest); | 1207 | free(dest); |
1205 | #endif | 1208 | #endif |
1206 | } | 1209 | } |