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?
Thanks,
Aron
- fchdir() question Barath Aron
-