lib/nspath: Fix nspath_mkdir_p()

The "no-testing-but-committed anyways" strategy wasn't all that
stellar, it seems, and especially not for a function hacked up in
under three minutes while trying to put on a jacket at the same
time.

With some testing and another two minutes of hacking we fix it up
to good working order.

While at it, we mention in the doxygen comments that this function
will *always* taint errno with ENOENT if one path component doesn't
exist and document the behaviour when a trailing slash is present
and NSPATH_MKDIR_SKIP_LAST is used (ie, the full path is created
just as if NSPATH_MKDIR_SKIP_LAST wasn't passed in the options flag).

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2585 5f96b256-904b-4d8d-8c98-d829582c6739