Skip to content

Commit 394f2a4

Browse files
committed
cptofs: Don't overwrite failure with umount return value
When cptofs fails to process any item, return value has been overwritten with return value from lkl_umount_dev, so cptofs wasn't returning error when it was supposed to. Signed-off-by: Yuriy Taraday <[email protected]>
1 parent fd7bb8a commit 394f2a4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/lkl/cptofs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ int copy_one(const char *src, const char *mpoint, const char *dst)
560560
int main(int argc, char **argv)
561561
{
562562
struct lkl_disk disk;
563-
long ret;
563+
long ret, umount_ret;
564564
int i;
565565
char mpoint[32];
566566
unsigned int disk_id;
@@ -613,7 +613,9 @@ int main(int argc, char **argv)
613613
break;
614614
}
615615

616-
ret = lkl_umount_dev(disk_id, cla.part, 0, 1000);
616+
umount_ret = lkl_umount_dev(disk_id, cla.part, 0, 1000);
617+
if (ret == 0)
618+
ret = umount_ret;
617619

618620
out_close:
619621
close(disk.fd);

0 commit comments

Comments
 (0)