mhttpd crash in getcwd()

Issue #297 resolved
dd1 created an issue

I see getcwd() return NULL. This is strange, but maybe correct if truely it cannot find where we are. It looks like getcwd() does quite a bit of directory listing and traversal. Certainly if current directory was deleted, getcwd() would not find it.

Anyhow, this causes a crash in mhttpd, in get_resources() or something link that.

I think code should be prepared for getcwd() returning NULL and do something reasonable.

P.S. my copy of “man getcwd” reads this “On  failure,  these  functions return NULL, and errno is set to indicate the error”.

K.O.