btrfs-progs: image: return negativer error from all paths in mdrestore_init

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-10-03 15:11:13 +02:00
parent 3956c16d0b
commit 9287b8630c
1 changed files with 4 additions and 1 deletions

View File

@ -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);