From cd30bc124608eda602833b1b0a49f26e96e2f648 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 19 Nov 2017 13:07:51 +0100 Subject: [PATCH] dns: don't stat relative paths when detecting resolved use NetworkManager daemon has no defined working directory. It makes no sense to ever open or stat relative paths. Just skip them. https://bugzilla.gnome.org/show_bug.cgi?id=790446 (cherry picked from commit 25267f9d274f93c57b051eca607096ac0c28b4b4) --- src/dns/nm-dns-manager.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index e6075d03fe..973abc1c1b 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -1594,7 +1594,10 @@ _resolvconf_resolved_managed (void) /* see if resolv.conf resolves to one of the candidate * paths (or whether it is hard-linked). */ for (i = 0; i < G_N_ELEMENTS (RESOLVED_PATHS); i++) { - if ( stat (RESOLVED_PATHS[i], &st_test) == 0 + const char *p = RESOLVED_PATHS[i]; + + if ( p[0] == '/' + && stat (p, &st_test) == 0 && st.st_dev == st_test.st_dev && st.st_ino == st_test.st_ino) return TRUE;