diff --git a/programs/discontig_bg_test/punch_hole.c b/programs/discontig_bg_test/punch_hole.c
index bdfa8be..9e10c4e 100755
--- a/programs/discontig_bg_test/punch_hole.c
+++ b/programs/discontig_bg_test/punch_hole.c
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
+#include <dirent.h>
 
 #include "resv.h"
 
@@ -138,6 +139,7 @@ static int punch_hole(int fd, uint64_t start, uint64_t len)
 int main(int argc, char *argv[])
 {
 	int fd, ret = 0;
+	DIR *pdir = NULL;
 
 	ret = parse_opts(argc, argv);
 	if (ret) {
@@ -145,12 +147,17 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
-	fd = open_file(filename);
+	pdir = opendir(filename);
+	if (pdir == NULL) {
+		fprintf(stderr, "Opendir %s failed.\n", filename);
+		ret = -1;
+	}
+	fd = dirfd(pdir);
+	printf("fd = %d\n",fd);
 	if (fd < 0) {
-		fprintf(stderr, "Open file %s failed.\n", filename);
+		fprintf(stderr, "Open fd %s failed.\n", filename);
 		ret = -1;
 	}
-
 	ret = punch_hole(fd, start, len);
 	if (ret < 0)
 		fprintf(stderr, "Punch hole failed.\n");
