On Mon, Jul 23, 2012 at 4:31 PM, Kirill A. Shutemov <kir...@shutemov.name> wrote: > + const char *err = strerror_r(errnum, buf, buflen); > + > + if (err != buf && buflen > 0) { > + size_t len = strlen(err); > + char *c = mempcpy(buf, err, min(buflen - 1, len)); > + *c = '\0'; > + }
No need to check for err == NULL. buflen == 0 is a possibility given the interface but I'd say this is an error and should be tested for at the beginning of the function and the call should fail or even abort the program. -- 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/