You call opendir without a path, this will not work.