aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Tomi Leppänen <tomi.leppanen@jolla.com>2021-03-03 09:12:21 +0200
committerLibravatar Tomi Leppänen <tomi.leppanen@jolla.com>2021-03-03 09:54:17 +0200
commit732e217c3e57a79958f114024a21a7b6a102f188 (patch)
treeb94ca3e18ae5ccab3c290ee489a1fe68877e280b /src
parentMerge pull request #4016 from pirate486743186/patch-5 (diff)
downloadfirejail-732e217c3e57a79958f114024a21a7b6a102f188.tar.gz
firejail-732e217c3e57a79958f114024a21a7b6a102f188.tar.zst
firejail-732e217c3e57a79958f114024a21a7b6a102f188.zip
Improve error reporting while mounting
Move error message after debug logging and add cause message. Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
Diffstat (limited to 'src')
-rw-r--r--src/firejail/fs_etc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/firejail/fs_etc.c b/src/firejail/fs_etc.c
index b9ed81db3..d093d5637 100644
--- a/src/firejail/fs_etc.c
+++ b/src/firejail/fs_etc.c
@@ -18,6 +18,7 @@
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/ 19*/
20#include "firejail.h" 20#include "firejail.h"
21#include <errno.h>
21#include <sys/mount.h> 22#include <sys/mount.h>
22#include <sys/stat.h> 23#include <sys/stat.h>
23#include <sys/types.h> 24#include <sys/types.h>
@@ -147,7 +148,7 @@ void fs_private_dir_copy(const char *private_dir, const char *private_run_dir, c
147 struct stat s; 148 struct stat s;
148 if (stat(private_dir, &s) == -1) { 149 if (stat(private_dir, &s) == -1) {
149 if (arg_debug) 150 if (arg_debug)
150 printf("Cannot find %s\n", private_dir); 151 printf("Cannot find %s: %s\n", private_dir, strerror(errno));
151 return; 152 return;
152 } 153 }
153 154
@@ -191,16 +192,17 @@ void fs_private_dir_mount(const char *private_dir, const char *private_run_dir)
191 assert(private_dir); 192 assert(private_dir);
192 assert(private_run_dir); 193 assert(private_run_dir);
193 194
195 if (arg_debug)
196 printf("Mount-bind %s on top of %s\n", private_run_dir, private_dir);
197
194 // nothing to do if directory does not exist 198 // nothing to do if directory does not exist
195 struct stat s; 199 struct stat s;
196 if (stat(private_dir, &s) == -1) { 200 if (stat(private_dir, &s) == -1) {
197 if (arg_debug) 201 if (arg_debug)
198 printf("Cannot find %s\n", private_dir); 202 printf("Cannot find %s: %s\n", private_dir, strerror(errno));
199 return; 203 return;
200 } 204 }
201 205
202 if (arg_debug)
203 printf("Mount-bind %s on top of %s\n", private_run_dir, private_dir);
204 if (mount(private_run_dir, private_dir, NULL, MS_BIND|MS_REC, NULL) < 0) 206 if (mount(private_run_dir, private_dir, NULL, MS_BIND|MS_REC, NULL) < 0)
205 errExit("mount bind"); 207 errExit("mount bind");
206 fs_logger2("mount", private_dir); 208 fs_logger2("mount", private_dir);