mirror of
https://git.proxmox.com/git/fwupd
synced 2025-06-06 07:46:22 +00:00
Unexport fu_common_realpath()
We don't want plugins to be using this.
This commit is contained in:
parent
2c5e4ff3ab
commit
518ba8b6f7
@ -79,3 +79,4 @@ Remember: Plugins should be upstream!
|
|||||||
* `fu_common_set_firmware_search_path()`: Use `fu_kernel_set_firmware_search_path` instead.
|
* `fu_common_set_firmware_search_path()`: Use `fu_kernel_set_firmware_search_path` instead.
|
||||||
* `fu_common_reset_firmware_search_path()`: Use `fu_kernel_reset_firmware_search_path` instead.
|
* `fu_common_reset_firmware_search_path()`: Use `fu_kernel_reset_firmware_search_path` instead.
|
||||||
* `fu_common_firmware_builder()`: You should not be using this.
|
* `fu_common_firmware_builder()`: You should not be using this.
|
||||||
|
* `fu_common_realpath()`: You should not be using this.
|
||||||
|
@ -663,48 +663,6 @@ fu_common_dump_bytes(const gchar *log_domain, const gchar *title, GBytes *bytes)
|
|||||||
fu_common_dump_raw(log_domain, title, data, len);
|
fu_common_dump_raw(log_domain, title, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* fu_common_realpath:
|
|
||||||
* @filename: a filename
|
|
||||||
* @error: (nullable): optional return location for an error
|
|
||||||
*
|
|
||||||
* Finds the canonicalized absolute filename for a path.
|
|
||||||
*
|
|
||||||
* Returns: a filename, or %NULL if invalid or not found
|
|
||||||
*
|
|
||||||
* Since: 1.2.6
|
|
||||||
**/
|
|
||||||
gchar *
|
|
||||||
fu_common_realpath(const gchar *filename, GError **error)
|
|
||||||
{
|
|
||||||
char full_tmp[PATH_MAX];
|
|
||||||
|
|
||||||
g_return_val_if_fail(filename != NULL, NULL);
|
|
||||||
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
|
||||||
|
|
||||||
#ifdef HAVE_REALPATH
|
|
||||||
if (realpath(filename, full_tmp) == NULL) {
|
|
||||||
#else
|
|
||||||
if (_fullpath(full_tmp, filename, sizeof(full_tmp)) == NULL) {
|
|
||||||
#endif
|
|
||||||
g_set_error(error,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_INVALID_DATA,
|
|
||||||
"cannot resolve path: %s",
|
|
||||||
strerror(errno));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (!g_file_test(full_tmp, G_FILE_TEST_EXISTS)) {
|
|
||||||
g_set_error(error,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_INVALID_DATA,
|
|
||||||
"cannot find path: %s",
|
|
||||||
full_tmp);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return g_strdup(full_tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fu_common_fnmatch:
|
* fu_common_fnmatch:
|
||||||
* @pattern: a glob pattern, e.g. `*foo*`
|
* @pattern: a glob pattern, e.g. `*foo*`
|
||||||
|
@ -171,8 +171,6 @@ typedef enum {
|
|||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
fu_common_get_path(FuPathKind path_kind);
|
fu_common_get_path(FuPathKind path_kind);
|
||||||
gchar *
|
|
||||||
fu_common_realpath(const gchar *filename, GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
GPtrArray *
|
GPtrArray *
|
||||||
fu_common_filename_glob(const gchar *directory,
|
fu_common_filename_glob(const gchar *directory,
|
||||||
const gchar *pattern,
|
const gchar *pattern,
|
||||||
|
@ -291,7 +291,6 @@ LIBFWUPDPLUGIN_1.2.5 {
|
|||||||
|
|
||||||
LIBFWUPDPLUGIN_1.2.6 {
|
LIBFWUPDPLUGIN_1.2.6 {
|
||||||
global:
|
global:
|
||||||
fu_common_realpath;
|
|
||||||
fu_device_activate;
|
fu_device_activate;
|
||||||
fu_device_get_firmware_size_max;
|
fu_device_get_firmware_size_max;
|
||||||
fu_device_get_firmware_size_min;
|
fu_device_get_firmware_size_min;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <gio/gunixinputstream.h>
|
#include <gio/gunixinputstream.h>
|
||||||
#endif
|
#endif
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_UTSNAME_H
|
#ifdef HAVE_UTSNAME_H
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
@ -2096,6 +2097,39 @@ fu_engine_is_running_offline(FuEngine *self)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GIO_UNIX
|
||||||
|
static gchar *
|
||||||
|
fu_realpath(const gchar *filename, GError **error)
|
||||||
|
{
|
||||||
|
char full_tmp[PATH_MAX];
|
||||||
|
|
||||||
|
g_return_val_if_fail(filename != NULL, NULL);
|
||||||
|
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
|
#ifdef HAVE_REALPATH
|
||||||
|
if (realpath(filename, full_tmp) == NULL) {
|
||||||
|
#else
|
||||||
|
if (_fullpath(full_tmp, filename, sizeof(full_tmp)) == NULL) {
|
||||||
|
#endif
|
||||||
|
g_set_error(error,
|
||||||
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_INVALID_DATA,
|
||||||
|
"cannot resolve path: %s",
|
||||||
|
strerror(errno));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!g_file_test(full_tmp, G_FILE_TEST_EXISTS)) {
|
||||||
|
g_set_error(error,
|
||||||
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_INVALID_DATA,
|
||||||
|
"cannot find path: %s",
|
||||||
|
full_tmp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return g_strdup(full_tmp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_engine_offline_setup(GError **error)
|
fu_engine_offline_setup(GError **error)
|
||||||
{
|
{
|
||||||
@ -2108,7 +2142,7 @@ fu_engine_offline_setup(GError **error)
|
|||||||
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
/* does already exist */
|
/* does already exist */
|
||||||
filename = fu_common_realpath(trigger, NULL);
|
filename = fu_realpath(trigger, NULL);
|
||||||
if (g_strcmp0(filename, symlink_target) == 0) {
|
if (g_strcmp0(filename, symlink_target) == 0) {
|
||||||
g_debug("%s already points to %s, skipping creation", trigger, symlink_target);
|
g_debug("%s already points to %s, skipping creation", trigger, symlink_target);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user