It seems each call to `gets()` opens `/dev/null`, causing input file descriptor to be overridden with a new one on each call and file descriptor leak.