Closed eworm-de closed 3 years ago
I don't like to clutter the source with ugly #pragma
stuff just to shut up compiler warnings. It might also not be supported by more niche compilers like cproc
which are known to compile vis without problems. Casting the return value to void
would be acceptable, but it seems like gcc decided to ignore that long standing idiom and warn anyway.
Also the the code path is currently never taken because the function is always called with AT_FDCWD
. It was done in preparation for some experimentation with a client/server architecture where the the file descriptor could be passed from the client to the server.
Yes, all current solutions are more or less ugly... No idea why casting to void
does no longer work.
How about something like this?
if (fchdir(cwd)) /* ignore return */ ;
We are in error path and there's nothing we can do. Just ignore.
As clang tries to be compatible with gcc this should be portable.