diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2009-08-23 02:46:03 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2009-08-23 02:46:03 +0800 |
commit | 3c295ca877066fadc2b0fc0944a225aa11afc2d9 (patch) | |
tree | 0fb4b800cb3b46be825eb6d1ad883e77ea84fe0d /devel/seed/files/patch-libseed_seed-importer.c | |
parent | a43aefbd8b8a356fc1890d8f240f76d9e2fb2f6c (diff) | |
download | marcuscom-ports-3c295ca877066fadc2b0fc0944a225aa11afc2d9.tar marcuscom-ports-3c295ca877066fadc2b0fc0944a225aa11afc2d9.tar.gz marcuscom-ports-3c295ca877066fadc2b0fc0944a225aa11afc2d9.tar.bz2 marcuscom-ports-3c295ca877066fadc2b0fc0944a225aa11afc2d9.tar.lz marcuscom-ports-3c295ca877066fadc2b0fc0944a225aa11afc2d9.tar.xz marcuscom-ports-3c295ca877066fadc2b0fc0944a225aa11afc2d9.tar.zst marcuscom-ports-3c295ca877066fadc2b0fc0944a225aa11afc2d9.zip |
Use a more Linuxy approach to realpath(). This seems to be safe on FreeBSD.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@12677 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'devel/seed/files/patch-libseed_seed-importer.c')
-rw-r--r-- | devel/seed/files/patch-libseed_seed-importer.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/devel/seed/files/patch-libseed_seed-importer.c b/devel/seed/files/patch-libseed_seed-importer.c index fb4f5d246..c216fa88c 100644 --- a/devel/seed/files/patch-libseed_seed-importer.c +++ b/devel/seed/files/patch-libseed_seed-importer.c @@ -1,32 +1,38 @@ ---- libseed/seed-importer.c.orig 2009-08-22 14:10:19.000000000 -0400 -+++ libseed/seed-importer.c 2009-08-22 14:17:07.000000000 -0400 -@@ -20,8 +20,10 @@ - // TODO: Don't use GNU libc extension canonicalize_file_name, don't use realpath? - #define _GNU_SOURCE +--- libseed/seed-importer.c.orig 2009-08-10 16:23:35.000000000 -0400 ++++ libseed/seed-importer.c 2009-08-22 14:36:00.000000000 -0400 +@@ -22,6 +22,8 @@ -+#include <sys/param.h> #include <gio/gio.h> #include <string.h> +#include <stdlib.h> ++#include <unistd.h> #include "seed-private.h" -@@ -637,8 +639,8 @@ seed_importer_handle_file (JSContextRef +@@ -637,8 +639,9 @@ seed_importer_handle_file (JSContextRef JSValueRef js_file_dirname; JSObjectRef global, c_global; JSStringRef file_contents, file_name; - gchar *contents, *walk, *file_path, *canonical, *absolute_path; -- gchar *normalized_path; + gchar *contents, *walk, *file_path, *canonical, *absolute_path, *normalp; -+ gchar normalized_path[PATH_MAX]; + gchar *normalized_path; ++ gsize path_max; file_path = g_build_filename (dir, file, NULL); canonical = seed_importer_canonicalize_path (file_path); -@@ -692,9 +694,9 @@ seed_importer_handle_file (JSContextRef +@@ -692,15 +695,24 @@ seed_importer_handle_file (JSContextRef g_path_get_dirname (file_path), NULL); } - normalized_path = canonicalize_file_name (absolute_path); ++#ifdef PATH_MAX ++ path_max = PATH_MAX; ++#else ++ path_max = pathconf (absolute_path, _PC_PATH_MAX); ++ if (path_max <= 0) ++ path_max = 4096; ++#endif ++ normalized_path = (gchar *) g_malloc (path_max); + normalp = realpath (absolute_path, normalized_path); - js_file_dirname = seed_value_from_string (ctx, normalized_path, NULL); @@ -34,3 +40,10 @@ seed_object_set_property (nctx, global, "__script_path__", js_file_dirname); + g_hash_table_insert (file_imports, canonical, global); + g_free (file_path); + g_free (absolute_path); ++ g_free (normalized_path); + + JSEvaluateScript (nctx, file_contents, NULL, file_name, 0, exception); + |