From: Rusty Russell Date: Tue, 8 Sep 2009 10:59:37 +0000 (+0930) Subject: Fix grab_file on other than regular files. X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=54299958430208905a97aff862ec0c51cd011d16;hp=822bce88355ced4b80ea8a0044d12cb90eaa234a Fix grab_file on other than regular files. --- diff --git a/ccan/grab_file/grab_file.c b/ccan/grab_file/grab_file.c index b3a2f54d..68a3b7cd 100644 --- a/ccan/grab_file/grab_file.c +++ b/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;