From: Christian Heinrich Date: Fri, 17 Jun 2016 08:49:37 +0000 (+0200) Subject: [XBT] Fix array indices in memory_map.cpp X-Git-Tag: v3_14~976^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5d98a94013bfc4b0ad30cedfe65aa30220bef737 [XBT] Fix array indices in memory_map.cpp Also add an 'else' case that should never be reached. See man(5) proc for more details. --- diff --git a/src/xbt/memory_map.cpp b/src/xbt/memory_map.cpp index d9092a25db..9babc54830 100644 --- a/src/xbt/memory_map.cpp +++ b/src/xbt/memory_map.cpp @@ -123,10 +123,14 @@ XBT_PRIVATE std::vector get_memory_map(pid_t pid) if (memreg.prot == 0) memreg.prot |= PROT_NONE; - if (lfields[1][4] == 'p') + if (lfields[1][3] == 'p') memreg.flags |= MAP_PRIVATE; - else if (lfields[1][4] == 's') + else if (lfields[1][3] == 's') memreg.flags |= MAP_SHARED; + else { + //fprintf(stderr,"%s", line); + xbt_die("Flag was neither 'p' (private) nor 's' (shared). This should have never happened! Instead, the permissions column was set to: %s", lfields[1]); + } /* Get the offset value */ memreg.offset = std::strtoull(lfields[2], &endptr, 16);