before the change section_flags_string() ignored unknown section
flags: snprintf() did write numeric value into buffer, but
"*cp = '\0'" negated the effect.
The change advances the 'cp' pointer'.
While at it add a '|' separator between known and unknown flags.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+2020-12-31 Sergei Trofimovich <slyfox@gentoo.org>
+
+ * elflint.c (section_flags_string): Update cp pointer after
+ snprintf for unknown flags.
+
2020-12-16 Érico Nogueira <ericonr@disroot.org>
* readelf.c (qsort_r): Use qsort for improved portability.
}
if (flags != 0 || cp == buf)
- snprintf (cp, len - 1, "%" PRIx64, (uint64_t) flags);
-
+ {
+ int r = snprintf (cp, len - 1, "%s%" PRIx64,
+ (cp == buf) ? "" : "|", (uint64_t) flags);
+ if (r > 0)
+ cp += r;
+ }
*cp = '\0';
return buf;