From 0e79b4bb2da4eb75723685a2cfeac937e68fe33c Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Mon, 24 Apr 2017 21:04:12 +0200 Subject: [PATCH] inet: Only try to read file contents if it exits When the file doesn't exits we get Cannot read /proc/net/pnp Failed to open file '/proc/net/pnp': No such file or directory in the log. --- src/inet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/inet.c b/src/inet.c index 99151b053..b283db89f 100644 --- a/src/inet.c +++ b/src/inet.c @@ -2997,7 +2997,8 @@ static int get_nfs_server_ip(const char *cmdline_file, const char *pnp_file, goto out; } - if (!g_file_get_contents(pnp_file, &pnp, NULL, &error)) { + if (g_file_test(pnp_file, G_FILE_TEST_EXISTS) && + !g_file_get_contents(pnp_file, &pnp, NULL, &error)) { connman_error("%s: Cannot read %s %s\n", __func__, pnp_file, error->message); goto out;