Skip to content

Commit

Permalink
inet: Only try to read file contents if it exits
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
igaw committed Apr 24, 2017
1 parent b92e8ff commit 0e79b4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0e79b4b

Please sign in to comment.