]> mj.ucw.cz Git - libucw.git/commitdiff
Define _GNU_SOURCE, so that pread/pwrite work with glibc 2.1.
authorMartin Mares <mj@ucw.cz>
Sun, 4 Jun 2000 23:15:58 +0000 (23:15 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 4 Jun 2000 23:15:58 +0000 (23:15 +0000)
Don't forget to print out fd's in fatal error messages.

lib/pagecache.c

index b51054afce508f9c8e9ebf097a363c4e15a4aac6..149986d992243e21b5140625820d07fa8eb64c93 100644 (file)
@@ -1,9 +1,11 @@
 /*
  *     Sherlock Library -- File Page Cache
  *
- *     (c) 1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1999--2000 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
  */
 
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -114,7 +116,7 @@ flush_page(struct page_cache *c, struct page *p)
   if (s < 0)
     die("pgc_write(%d): %m", p->fd);
   if (s != (int) c->page_size)
-    die("pgc_write(%d): incomplete page (only %d of %d)", s, c->page_size);
+    die("pgc_write(%d): incomplete page (only %d of %d)", p->fd, s, c->page_size);
   p->flags &= ~PG_FLAG_DIRTY;
   c->stat_write++;
 }
@@ -291,7 +293,7 @@ pgc_read(struct page_cache *c, int fd, sh_off_t pos)
       if (s < 0)
        die("pgc_read(%d): %m", fd);
       if (s != (int) c->page_size)
-       die("pgc_read(%d): incomplete page (only %d of %d)", s, c->page_size);
+       die("pgc_read(%d): incomplete page (only %d of %d)", p->fd, s, c->page_size);
       p->flags |= PG_FLAG_VALID;
     }
   return p;