Fail path resolution early on symlink detection error.

This change makes path resolution return error if check whether
a path component is a symlink returns any error except EINVAL (not a symlink).

This is needed to make cleaning ".." components from path
to fail on nonexistent files preceding ".." part.
For example, "/nonexistent/../bin" was resolving the same way as "/bin"
without this change.

See https://bugs.merproject.org/show_bug.cgi?id=834 for details.

Signed-off-by: Oleg Girko <oleg.girko@jolla.com>