returns a zero on success and non-zero on failure. Submitted by: Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>