Browse Source

Fix grab_file on other than regular files.

Rusty Russell 16 years ago
parent
commit
5429995843
1 changed files with 1 additions and 1 deletions
  1. 1 1
      ccan/grab_file/grab_file.c

+ 1 - 1
ccan/grab_file/grab_file.c

@@ -17,7 +17,7 @@ void *grab_fd(const void *ctx, int fd, size_t *size)
 		size = &s;
 	*size = 0;
 
-	if (fstat(fd, &st) == 0)
+	if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode))
 		max = st.st_size;
 	else
 		max = 16384;