summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Henriksson <andreas.henriksson@endian.se>2014-07-15 20:34:15 +0200
committerColin Walters <walters@verbum.org>2014-07-15 16:33:48 -0400
commitde2619271ee3ab42971fc770cae110f23e330c30 (patch)
tree30b4b3e55902587402480452ead342b80cd2d394
parent1462c8110bf731222a3d57e96f31e9835652b0f4 (diff)
downloadlibgsystem-de2619271ee3ab42971fc770cae110f23e330c30.tar.gz
fileutil: avoid using PATH_MAX
Use the dynamically allocated buffer returned by realpath instead of using PATH_MAX which is not defined on platforms like Hurd.
-rw-r--r--src/gsystem-file-utils.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gsystem-file-utils.c b/src/gsystem-file-utils.c
index 6a35ed7..c157d1d 100644
--- a/src/gsystem-file-utils.c
+++ b/src/gsystem-file-utils.c
@@ -1363,18 +1363,23 @@ GFile *
gs_file_realpath (GFile *file)
{
gchar *path;
- gchar path_real[PATH_MAX];
+ char *path_real;
+ GFile *file_real;
path = g_file_get_path (file);
- if (realpath ((const char *) path, path_real) == NULL)
+ path_real = realpath((const char *) path, NULL);
+ if (path_real == NULL)
{
g_free (path);
return NULL;
}
g_free (path);
- return g_file_new_for_path (path_real);
+ file_real = g_file_new_for_path (path_real);
+ free (path_real);
+
+ return file_real;
}
#ifdef GSYSTEM_CONFIG_XATTRS