Looks like fildes is not a valid pointer.