aboutsummaryrefslogtreecommitdiffstats
path: root/community/libqmi/musl-compat-canonicalize_file_name.patch
blob: 15b38493746a5e174fad0e5e20f7e480dff25c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- libqmi-1.17.901/src/libqmi-glib/qmi-utils.h
+++ libqmi-1.17.901/src/libqmi-glib/qmi-utils.h.new
@@ -29,6 +29,24 @@
 #error "Only <libqmi-glib.h> can be included directly."
 #endif
 
+#ifndef HAVE_CANONICALIZE_FILE_NAME
+#include <limits.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+static char * canonicalize_file_name(const char *path)
+{
+       char buf[PATH_MAX] = { };
+
+       snprintf(buf, sizeof(buf) - 1, "%s", path);
+
+       if (!realpath(path, buf))
+               return NULL;
+
+       return strdup(buf);
+}
+#endif
+
 #include <glib.h>
 
 G_BEGIN_DECLS