Fix error handling in library code

Library code should not call die(). Fixes #7.

Signed-off-by: Pekka Enberg <penberg@kernel.org>