summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/filetype.c b/common/filetype.c
index b784bffe4d..0120913a56 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -89,10 +89,10 @@ enum filetype file_name_detect_type(const char *filename)
if (fd < 0)
return fd;
- buf = xmalloc(512);
+ buf = xzalloc(512);
ret = read(fd, buf, 512);
- if (ret != 512)
+ if (ret < 0)
goto err_out;
type = file_detect_type(buf);