diff --git a/btrfs-image.c b/btrfs-image.c index bbe4f638..46d3196a 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -1880,8 +1880,11 @@ static int mdrestore_init(struct mdrestore_struct *mdres, for (i = 0; i < num_threads; i++) { ret = pthread_create(mdres->threads + i, NULL, restore_worker, mdres); - if (ret) + if (ret) { + /* pthread_create returns errno directly */ + ret = -ret; break; + } } if (ret) mdrestore_destroy(mdres, i + 1);