gentoo: use /var/run for new /run compatibility
[util-vserver.git] / src / h2ext.c
index 50d3094..13366df 100644 (file)
@@ -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) {