|Date:||Wed, 8 Aug 2018 09:25:12 +0200|
|User-agent:||Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1|
Hello,I looked into the fchdir.c (I was curious how it is implemented), and I noticed something interesting. This is not an actual bug, but I wonder why. The ensure_dirs_slot() function allocates some memory, and it uses malloc() if no memory was allocated before, and uses realloc() otherwise. However, you can found this statement in the POSIX standard (and some equivalent stuff since C89): "If ptr is a null pointer, realloc() shall be equivalent to malloc() for the specified size." To me, it looks the ternary is unnecessary there, and only a single realloc() is fine.
So the question: What system implements a realloc() which does not work if ptr is null pointer? Or this is really a bug?
|[Prev in Thread]||Current Thread||[Next in Thread]|