Did you want to fix the inconsistent use of -1 instead of 1 as the return code for some functions?

Other than that it looks good (i'm biased, of course :-))

--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.