fd = EopenD(file, O_RDONLY, 0);
Efstat(fd, &st);
mapping = mmap(NULL, MIN(st.st_size, MAX_PEEK_SIZE), PROT_READ, MAP_SHARED, fd, 0);
- if (!mapping) {
+ if (mapping == MAP_FAILED) {
perror("mmap()");
Eclose(fd);
return -1;
}
}
-static inline ALWAYSINLINE void
-WRITE_INT(int fd, int num)
-{
- char buf[sizeof(num)*3+2];
- size_t l;
-
- l = utilvserver_fmt_long(buf,num);
-
- Vwrite(fd, buf, l);
-}
-
static int
load_description(const char *file, file_format_t **head)
{
*buf = '\0';
while (1) {
- if ((eol = strchr(buf, '\n')) == NULL && (end - buf) < (sizeof(buf) - 1)) {
+ if ((eol = strchr(buf, '\n')) == NULL && (end - buf) < (signed) (sizeof(buf) - 1)) {
bytes_read = Eread(fd, end, sizeof(buf) - 1 - (end - buf));
/* EOF, implicit newline */
if (bytes_read == 0) {