summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init.c13
-rw-r--r--misc.c3
2 files changed, 15 insertions, 1 deletions
diff --git a/init.c b/init.c
index 05d8cd7..218fae1 100644
--- a/init.c
+++ b/init.c
@@ -439,6 +439,19 @@ init_static (void)
return false;
#endif
+#if 0
+ {
+ struct gc_arena gc = gc_new ();
+ const char *fn = gen_path ("foo",
+ "bar",
+ &gc);
+ printf ("%s\n", fn);
+ gc_free (&gc);
+ }
+
+ return false;
+#endif
+
return true;
}
diff --git a/misc.c b/misc.c
index 97e8049..901e8cb 100644
--- a/misc.c
+++ b/misc.c
@@ -1129,7 +1129,8 @@ gen_path (const char *directory, const char *filename, struct gc_arena *gc)
#endif
)
{
- struct buffer out = alloc_buf_gc (256, gc);
+ const size_t outsize = strlen(safe_filename) + (directory ? strlen (directory) : 0) + 16;
+ struct buffer out = alloc_buf_gc (outsize, gc);
char dirsep[2];
dirsep[0] = OS_SPECIFIC_DIRSEP;