summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2020-01-06 16:57:00 +0000
committerEmīls Piņķis <emils@mullvad.net>2020-01-07 11:46:40 +0000
commit6555c147c4ee7722a99f60c2c8d644f2b6c724ac (patch)
tree067df1e5098c61c7f8f9277632b957d4940d406d /talpid-core/src
parent1bef4d245fbe310bd3d852d9b12c95031378dea3 (diff)
downloadmullvadvpn-6555c147c4ee7722a99f60c2c8d644f2b6c724ac.tar.xz
mullvadvpn-6555c147c4ee7722a99f60c2c8d644f2b6c724ac.zip
Create empty dns config if /etc/resolv.conf doesn't exist
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/dns/linux/static_resolv_conf.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/talpid-core/src/dns/linux/static_resolv_conf.rs b/talpid-core/src/dns/linux/static_resolv_conf.rs
index 70ff38ddce..1a867a079d 100644
--- a/talpid-core/src/dns/linux/static_resolv_conf.rs
+++ b/talpid-core/src/dns/linux/static_resolv_conf.rs
@@ -172,6 +172,10 @@ impl DnsWatcher {
}
fn read_config() -> Result<Config> {
+ if !std::path::Path::new(RESOLV_CONF_PATH).exists() {
+ return Ok(Config::new());
+ }
+
let contents = fs::read_to_string(RESOLV_CONF_PATH)
.map_err(|e| Error::ReadResolvConf(RESOLV_CONF_PATH, e))?;
let config = Config::parse(&contents).map_err(|e| Error::ParseError(RESOLV_CONF_PATH, e))?;