open returns -1 on failure

Hi, spotted a bug. If a call to open() fails it returns -1. You code checks to see if open() returns zero.