From 925dd7cd99d10b3d606931a1fa424d79e76c0a6b Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sun, 8 Apr 2012 20:41:14 +0000 Subject: [PATCH] Ensure that bash's mkbuiltins won't pollute HAIKU_TOP. Introduces a commandline option to specify the filename of the temp_struct_filename, allowing the buildsystem to place it on the same volume as HAIKU_OUTPUT_DIR. Fixes #6746. --- src/bin/bash/builtins/Jamfile | 2 +- src/bin/bash/builtins/mkbuiltins.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bin/bash/builtins/Jamfile b/src/bin/bash/builtins/Jamfile index 59130c7285..d01a83ba68 100644 --- a/src/bin/bash/builtins/Jamfile +++ b/src/bin/bash/builtins/Jamfile @@ -47,7 +47,7 @@ rule MkBuiltinsExt actions MkBuiltinsExt1 { - $(2[1]) -externfile $(1[1]) -structfile $(1[2]) -noproduction $(2[2-]) ; + $(2[1]) -externfile $(1[1]) -tempstructfile $(1[2]).temp -structfile $(1[2]) -noproduction $(2[2-]) ; } local bashDefFiles = diff --git a/src/bin/bash/builtins/mkbuiltins.c b/src/bin/bash/builtins/mkbuiltins.c index b8363fed42..5fc28602ce 100644 --- a/src/bin/bash/builtins/mkbuiltins.c +++ b/src/bin/bash/builtins/mkbuiltins.c @@ -221,6 +221,8 @@ main (argc, argv) if (strcmp (arg, "-externfile") == 0) extern_filename = argv[arg_index++]; + else if (strcmp (arg, "-tempstructfile") == 0) + temp_struct_filename = argv[arg_index++]; else if (strcmp (arg, "-structfile") == 0) struct_filename = argv[arg_index++]; else if (strcmp (arg, "-noproduction") == 0) @@ -287,8 +289,11 @@ main (argc, argv) /* Open the files. */ if (struct_filename) { - temp_struct_filename = xmalloc (15); - sprintf (temp_struct_filename, "mk-%ld", (long) getpid ()); + if (!temp_struct_filename) + { + temp_struct_filename = xmalloc (15); + sprintf (temp_struct_filename, "mk-%ld", (long) getpid ()); + } structfile = fopen (temp_struct_filename, "w"); if (!structfile)