--- btrfs-image.c.orig 2009-02-15 14:49:17.000000000 +0100
+++ btrfs-image.c 2009-02-15 12:42:10.000000000 +0100
@@ -249,7 +249,7 @@
static int metadump_init(struct metadump_struct *md, struct btrfs_root *root,
FILE *out, int num_threads, int compress_level)
{
- int i, ret;
+ int i, ret = 0;
memset(md, 0, sizeof(*md));
pthread_cond_init(&md->cond, NULL);
@@ -608,7 +608,11 @@
if (async->start == BTRFS_SUPER_INFO_OFFSET)
update_super(outbuf);
+#ifdef __APPLE__
+ ret = pwrite(outfd, outbuf, size, async->start);
+#else
ret = pwrite64(outfd, outbuf, size, async->start);
+#endif
BUG_ON(ret != size);
pthread_mutex_lock(&mdres->mutex);
@@ -834,7 +838,9 @@
}
if (num_threads == 0 && compress_level > 0) {
+#ifdef _SC_NPROCESSORS_ONLN
num_threads = sysconf(_SC_NPROCESSORS_ONLN);
+#endif
if (num_threads <= 0)
num_threads = 1;
}