X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fh2ext.c;h=13366df7979ce79e8857ca46a438bb16f38b7af3;hb=f64dbf290eb891ebee9b40eabd5240d15a873568;hp=50d3094788edc26dcd1e384a79e4fb2679bfa78c;hpb=61de2f68fbd5622f996775cfa9bfebb4cb2ed069;p=util-vserver.git diff --git a/src/h2ext.c b/src/h2ext.c index 50d3094..13366df 100644 --- a/src/h2ext.c +++ b/src/h2ext.c @@ -148,7 +148,7 @@ process_file(file_format_t *head, const char *file, file_format_t *ret[2]) 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; @@ -210,17 +210,6 @@ byteswap(void *p, size_t len) } } -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) { @@ -239,7 +228,7 @@ 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) {