This test:
if (asprintf(&vs, "%ld.0", (long int)(1L + INT_MAX)) < 0)triggers integer overflow on 32-bit architectures, where int and long have the same width. You probably wanted:
if (asprintf(&vs, "%u.0\n", 1U + (unsigned int)INT_MAX))
--
Jakub Wilk

