Create STATEDIR [/var]/run/connman and unconditionally write resolv.conf
to this directory.
---
src/main.c | 6 ++++++
src/resolver.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/main.c b/src/main.c
index e46fa7b..6cf6bc8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -623,6 +623,12 @@ int main(int argc, char *argv[])
perror("Failed to create storage directory");
}
+ if (mkdir(STATEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
+ S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) {
+ if (errno != EEXIST)
+ perror("Failed to create storage directory");
+ }
+
umask(0077);
main_loop = g_main_loop_new(NULL, FALSE);
diff --git a/src/resolver.c b/src/resolver.c
index 6a64938..9db2756 100644
--- a/src/resolver.c
+++ b/src/resolver.c
@@ -130,7 +130,7 @@ static int resolvfile_export(void)
old_umask = umask(022);
- fd = open("/etc/resolv.conf", O_RDWR | O_CREAT | O_CLOEXEC,
+ fd = open(STATEDIR"/resolv.conf", O_RDWR | O_CREAT | O_CLOEXEC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd < 0) {
err = -errno;
--
2.1.4
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman