]> git.ozlabs.org Git - ccan/commitdiff
Fix grab_file on other than regular files.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 8 Sep 2009 10:59:37 +0000 (20:29 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 8 Sep 2009 10:59:37 +0000 (20:29 +0930)
ccan/grab_file/grab_file.c

index b3a2f54d512ea07f5c10b9e95c5cafbb59bd0771..68a3b7cde32e483ba5cd8af768be15132a2ced13 100644 (file)
@@ -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;