shl: handle pathconf() errors

It can return -1 (feature not supported, denied by a security module, etc.),
resulting in wrong allocation later on.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
(remove superfluous errno-checks)
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>