Include <stdint.h> to provide the definition of uintptr_t and fix
the GCC build failure
Signed-off-by: Ali Erdinc Koroglu <ali.koroglu@oss.qualcomm.com>
rmtree() concatenates the directory path and entry name into a
PATH_MAX buffer without checking for truncation, which -Wformat-
truncation flags on the Windows build where PATH_MAX is 260. A
truncated path would also make the cleanup delete the wrong file in
principle.
Check the snprintf() result and skip entries that do not fit; using
the return value also satisfies the warning. A skipped entry means
the parent rmdir() fails with ENOTEMPTY and the workdir lingers, so
report the skip on stderr instead of hiding it - the message names
the entry, making a leftover workdir traceable to its cause.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Add a cmocka unit test for the header-only helpers in oscompat.h:
- path_is_absolute(), checking POSIX and (under _WIN32) drive-letter
and UNC paths;
- qdl_mkdir_p(), checking recursive creation, idempotency on an
existing directory, trailing slashes, the "." and empty-path cases,
the ENAMETOOLONG guard, and failure when a path component is not a
directory.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>