Em Tue, Feb 10, 2015 at 06:18:53PM +0900, Masami Hiramatsu escreveu: > +static int asnprintf(char **strp, size_t size, const char *fmt, ...) > +{ > + va_list ap; > + int ret; > + if (!strp) > + return -EINVAL; > + va_start(ap, fmt); > + if (*strp) > + ret = vsnprintf(*strp, size, fmt, ap); > + else > + ret = vasprintf(strp, fmt, ap); > + va_end(ap); > + return ret; > +} > +static char *build_id__filename(const char *sbuild_id, char *bf, size_t size) > +{ > + char *tmp = bf; > + int ret = asnprintf(&bf, size, "%s/.build-id/%.2s/%s", buildid_dir, > + sbuild_id, sbuild_id + 2); > + if (ret < 0 || (tmp && size < (unsigned int)ret)) > + return NULL;
This is a good thing, i.e. checking if the formatting truncated something, i.e. vsnprintf honours 'size' but may return more than that, but next time try to get it into a separate patch :-) Anyway, after scratching my head with this extra thing/re-reading the vsnprintf man page, I'm applying this patch, thanks. - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/