From aae78a6fa458b5924a77674fbdb21dc98f704032 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 13 Nov 2020 11:51:19 +0100 Subject: libmbim-glib,device: realpath() returns NULL if path doesn't exist Running realpath() on a path that doesn't exist returns NULL, so don't even attempt to run g_file_test() on it. The g_file_test() may even be redundant, but well. (cherry picked from commit aff2313b4153a05f6466ebd337f53354398b25f2) --- src/libmbim-glib/mbim-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c index 745947b..a98b887 100644 --- a/src/libmbim-glib/mbim-device.c +++ b/src/libmbim-glib/mbim-device.c @@ -932,7 +932,7 @@ get_descriptors_filepath (MbimDevice *self) tmp = g_strdup_printf ("/sys/class/%s/%s/device", subsystems[i], device_basename); path = realpath (tmp, NULL); - if (g_file_test (path, G_FILE_TEST_EXISTS)) { + if (path && g_file_test (path, G_FILE_TEST_EXISTS)) { /* Now look for the parent dir with descriptors file. */ g_autofree gchar *dirname = NULL; -- cgit v1.2.1