Fix buffer problem with printing long Hwloc affinity mask

This change has the hwloc_bitmap_list_snprintf() function use the entire buffer
to print the mask.  There is no need to shorten the buffer length by 7.  It only
needs to be shortened by one byte.

llvm-svn: 267470
This commit is contained in:
Jonathan Peyton 2016-04-25 21:08:31 +00:00
parent 3e28229000
commit 1d5487c5d0
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ __kmp_affinity_print_mask(char *buf, int buf_len, kmp_affin_mask_t *mask)
// Need to truncate the affinity mask string and add ellipsis.
// To do this, we first write out the '{' + str(mask)
buf[0] = '{';
hwloc_bitmap_list_snprintf(buf+1, buf_len-7, (hwloc_bitmap_t)mask);
hwloc_bitmap_list_snprintf(buf+1, buf_len-1, (hwloc_bitmap_t)mask);
// then, what we do here is go to the 7th to last character, then go backwards until we are NOT
// on a digit then write "...}\0". This way it is a clean ellipsis addition and we don't
// overwrite part of an affinity number. i.e., we avoid something like { 45, 67, 8...} and get