Message ID | 20230324002441.987778-4-edliaw@google.com |
---|---|
State | Superseded |
Headers | show |
Series | tst_device.c: Handle Android path for backing device | expand |
Hi Edward,
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
diff --git a/lib/tst_device.c b/lib/tst_device.c index 2c83fb764..ba46b7613 100644 --- a/lib/tst_device.c +++ b/lib/tst_device.c @@ -88,8 +88,8 @@ int tst_find_free_loopdev(char *path, size_t path_len) rc = ioctl(ctl_fd, LOOP_CTL_GET_FREE); close(ctl_fd); if (rc >= 0) { - if (path) - set_dev_loop_path(rc, path, path_len); + if (path && set_dev_loop_path(rc, path, path_len)) + tst_brkm(TBROK, NULL, "Could not stat loop device %i", rc); tst_resm(TINFO, "Found free device %d '%s'", rc, path ?: ""); return rc;
tst_find_free_loopdev does not check the return value of set_dev_loop_path and will return the last attempted path even if it does not pass a stat check. Change it to return TBROK if it fails to acquire a loop device. Signed-off-by: Edward Liaw <edliaw@google.com> --- lib/tst_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)