[LTP] [PATCH v6 0/2] tst_find_backing_dev: fix stat fails /dev/root

Alessandro Carminati
2022-11-09T19:43:48Z

This version fixes:
* dirname can modify path: as suggested in the review a new buffer is
reserved in the stack and the path string is copied there.
* Secondly ioctl_loop05 passes the path to an image, but the self
test in /lib/newlib_tests/tst_device.c passes the mount point. I
didn't notice this in the test, however I fixed this case. In place
of trying open the file as suggested I preferred to use
S_ISREG(buf.st_mode) using the stat data already present.
As side note, since the /lib/newlib_tests/tst_device.c depends on
mkfs.ex2 external executable, its results depends on the mkfs.ext2
implementation. Using the busybox mkfs.ext2 implementation the test
fails out of the box since a problem with the loop block size.
* TERRNO flag missing in the error messages fixed.
* formatting errors fixed .
* else statement bracket indentation have been adjusted.

Alessandro Carminati (2):
tst_find_backing_dev: Get dev name from /sys/dev/block/*/uevent
c-test-api: Documentation updated

doc/c-test-api.txt | 7 +++-
lib/tst_device.c | 95 ++++++++++++++++++++++++++++++++--------------
2 files changed, 71 insertions(+), 31 deletions(-)