summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/filetype.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 40faff3ada..f662258db7 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -86,10 +86,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);