From 10f60cd893ddabfcefebf3e77d469e6e7b279cf8 Mon Sep 17 00:00:00 2001 From: Adam Szalkowski Date: Tue, 5 Sep 2006 09:23:38 +0000 Subject: [PATCH] mallon made it less gammlich --- ir/be/bemain.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ir/be/bemain.c b/ir/be/bemain.c index b1d6adeff..006418bc8 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -396,6 +396,7 @@ static void be_main_loop(FILE *file_handle) unsigned num_nodes_r = 0; char prof_filename[256]; char path[256]; + static const char suffix[] = ".prof"; #ifdef WITH_LIBCORE lc_timer_t *t_prolog = NULL; @@ -432,10 +433,10 @@ static void be_main_loop(FILE *file_handle) // dump_all_anchors(1); /* please FIXME! I'm a dirty hack. */ - snprintf(path, 256, "/proc/self/fd/%d", fileno(file_handle)); - memset(prof_filename, 0, 256); - readlink(path, prof_filename, 250); - strcat(prof_filename, ".prof"); + snprintf(path, sizeof(path), "/proc/self/fd/%d", fileno(file_handle)); + memset(prof_filename, 0, sizeof(path)); + readlink(path, prof_filename, sizeof(path) - sizeof(suffix)); + strcat(prof_filename, suffix); if(be_options.opt_profile) { ir_graph *prof_init_irg = be_profile_instrument(prof_filename); -- 2.20.1