summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-11-13 11:51:19 +0100
committerAleksander Morgado <aleksander@aleksander.es>2020-11-13 12:03:05 +0100
commitaae78a6fa458b5924a77674fbdb21dc98f704032 (patch)
tree68204e91cb36abe686b31e74575b0cbdd55daa28
parentcf7305621d21a4803d86e106ab6c882e3e3cef15 (diff)
downloadlibmbim-aae78a6fa458b5924a77674fbdb21dc98f704032.tar.gz
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)
-rw-r--r--src/libmbim-glib/mbim-device.c2
1 files changed, 1 insertions, 1 deletions
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;