Found error that compiler didn't catch. function call was missing a file descriptor