aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2017-11-10 09:42:14 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2017-11-10 09:42:14 -0500
commitac0d75f9431f28e0f2aa583d073c300883197e2e (patch)
tree8cf1c4c6cf23f896cf324f128bc127a77f086c28 /src
parenttentative fix for #1586 (diff)
downloadfirejail-ac0d75f9431f28e0f2aa583d073c300883197e2e.tar.gz
firejail-ac0d75f9431f28e0f2aa583d073c300883197e2e.tar.zst
firejail-ac0d75f9431f28e0f2aa583d073c300883197e2e.zip
fix resolv.conf for chroot setups - #1639
Diffstat (limited to 'src')
-rw-r--r--src/firejail/fs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/firejail/fs.c b/src/firejail/fs.c
index addeb619e..653a656b3 100644
--- a/src/firejail/fs.c
+++ b/src/firejail/fs.c
@@ -1123,7 +1123,9 @@ void fs_check_chroot_dir(const char *rootdir) {
1123 } 1123 }
1124 free(name); 1124 free(name);
1125 1125
1126 // check /etc/resolv.conf 1126 // there should be no checking on <chrootdir>/etc/resolv.conf
1127 // the file is replaced with the real /etc/resolv.conf anyway
1128#if 0
1127 if (asprintf(&name, "%s/etc/resolv.conf", rootdir) == -1) 1129 if (asprintf(&name, "%s/etc/resolv.conf", rootdir) == -1)
1128 errExit("asprintf"); 1130 errExit("asprintf");
1129 if (stat(name, &s) == 0) { 1131 if (stat(name, &s) == 0) {
@@ -1147,6 +1149,7 @@ void fs_check_chroot_dir(const char *rootdir) {
1147 } 1149 }
1148 } 1150 }
1149 free(name); 1151 free(name);
1152#endif
1150 1153
1151 // check x11 socket directory 1154 // check x11 socket directory
1152 if (getenv("FIREJAIL_X11")) { 1155 if (getenv("FIREJAIL_X11")) {
@@ -1222,6 +1225,7 @@ void fs_chroot(const char *rootdir) {
1222 errExit("asprintf"); 1225 errExit("asprintf");
1223 if (arg_debug) 1226 if (arg_debug)
1224 printf("Updating /etc/resolv.conf in %s\n", fname); 1227 printf("Updating /etc/resolv.conf in %s\n", fname);
1228 unlink(fname);
1225 if (copy_file("/etc/resolv.conf", fname, 0, 0, 0644) == -1) // root needed 1229 if (copy_file("/etc/resolv.conf", fname, 0, 0, 0644) == -1) // root needed
1226 fwarning("/etc/resolv.conf not initialized\n"); 1230 fwarning("/etc/resolv.conf not initialized\n");
1227 } 1231 }