Check whether last path component before ".." is a directory.

This change makes path resolution fail when a path component before ".."
is not a directory (or symlink pointing to a directory, but this is covered
by a different code path).

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