use BUFSIZ

This commit is contained in:
Sebastian Ramacher 2011-10-23 19:27:57 +02:00
parent 7ca688a964
commit c06a1a4df7

View file

@ -164,15 +164,14 @@ guess_type(const char* path)
}
const int fd = fileno(f);
static const size_t BLKSIZE = 4096;
guchar* content = NULL;
size_t length = 0u;
while (uncertain == TRUE) {
g_free((void*)content_type);
content_type = NULL;
content = g_realloc(content, length + BLKSIZE);
const ssize_t r = read(fd, content + length, BLKSIZE);
content = g_realloc(content, length + BUFSIZ);
const ssize_t r = read(fd, content + length, BUFSIZ);
if (r == -1) {
break;
}