2017-05-15 04:26:00 +02:00
|
|
|
From 8f6181b6f8dd82aa1ab1288cc7f2fd05d4a2519f Mon Sep 17 00:00:00 2001
|
2017-05-02 03:29:06 +02:00
|
|
|
From: Matt Weber <matthew.weber@rockwellcollins.com>
|
|
|
|
Date: Mon, 1 May 2017 19:55:07 -0500
|
|
|
|
Subject: [PATCH] musl compat canonicalize_file_name()
|
|
|
|
|
2017-05-15 04:26:00 +02:00
|
|
|
Adds an equivalent of canonicalize_file_name
|
2017-05-02 03:29:06 +02:00
|
|
|
using realpath().
|
|
|
|
|
|
|
|
Bug report (origin of this patch):
|
|
|
|
https://bugs.freedesktop.org/show_bug.cgi?id=99944
|
|
|
|
|
2017-05-15 04:26:00 +02:00
|
|
|
Bug report has been updated with suggestion to not use inline.
|
|
|
|
|
2017-05-02 03:29:06 +02:00
|
|
|
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
|
|
|
|
---
|
2017-05-04 21:33:49 +02:00
|
|
|
configure.ac | 2 ++
|
2017-05-15 04:26:00 +02:00
|
|
|
src/libqmi-glib/qmi-utils.c | 15 +++++++++++++++
|
|
|
|
2 files changed, 17 insertions(+)
|
2017-05-02 03:29:06 +02:00
|
|
|
|
2017-05-04 21:33:49 +02:00
|
|
|
diff --git a/configure.ac b/configure.ac
|
2017-05-15 04:26:00 +02:00
|
|
|
index c56fa3e..d835db4 100644
|
2017-05-04 21:33:49 +02:00
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
|
|
|
@@ -80,6 +80,8 @@ AC_SUBST(GLIB_LIBS)
|
|
|
|
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
|
|
|
|
AC_SUBST(GLIB_MKENUMS)
|
|
|
|
|
|
|
|
+AC_CHECK_FUNCS([canonicalize_file_name])
|
|
|
|
+
|
|
|
|
dnl qmi-firmware-update is optional, enabled by default
|
|
|
|
AC_ARG_ENABLE([firmware-update],
|
|
|
|
AS_HELP_STRING([--enable-firmware-update],
|
2017-05-15 04:26:00 +02:00
|
|
|
diff --git a/src/libqmi-glib/qmi-utils.c b/src/libqmi-glib/qmi-utils.c
|
|
|
|
index 29e5f22..26aff9e 100644
|
|
|
|
--- a/src/libqmi-glib/qmi-utils.c
|
|
|
|
+++ b/src/libqmi-glib/qmi-utils.c
|
|
|
|
@@ -34,6 +34,21 @@
|
|
|
|
#include "qmi-utils.h"
|
|
|
|
#include "qmi-error-types.h"
|
2017-05-02 03:29:06 +02:00
|
|
|
|
|
|
|
+#ifndef HAVE_CANONICALIZE_FILE_NAME
|
|
|
|
+#include <limits.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
|
|
|
|
+
|
2017-05-15 04:26:00 +02:00
|
|
|
/**
|
|
|
|
* SECTION:qmi-utils
|
|
|
|
* @title: Common utilities
|
2017-05-02 03:29:06 +02:00
|
|
|
--
|
2017-05-15 04:26:00 +02:00
|
|
|
1.9.1
|
2017-05-02 03:29:06 +02:00
|
|
|
|