On Tue, Feb 16, 2016 at 02:22:14PM +0100, Michael Haggerty wrote: > Theoretically, free() is allowed to change errno. So preserve the errno > from safe_create_leading_directories() across the call to free(). I wondered if this was actually a problem in practice. POSIX forbids recreational setting of errno to "0" , and there are no errors defined for free(). But apparently it is indeed a thing: https://sourceware.org/bugzilla/show_bug.cgi?id=17924 and our desired behavior will even become the standard in a future POSIX (not that we can rely on that for a long time...). I suspect in practice that most allocators would use the sbrk() heap for a small allocation like this, so we wouldn't run into any munmap() errors during the free. But obviously that's being way more intimate with the allocator than we should be, and your patch is a simple protection that works either way. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html