mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Use a more explicit check on readlink result
This should help the static analyzer to understand the code.
This commit is contained in:
parent
ee10b6f9a6
commit
976338f84c
2 changed files with 2 additions and 2 deletions
|
|
@ -247,7 +247,7 @@ static void read_dir(tommy_hashdyn* poolset, const char* base_dir, const char* s
|
|||
int ret;
|
||||
|
||||
ret = readlink(path_next, linkto, sizeof(linkto));
|
||||
if (ret < 0 || ret == sizeof(linkto)) {
|
||||
if (ret < 0 || ret >= PATH_MAX) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error in readlink symlink '%s'. %s.\n", path_next, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ static int devuuid_dev(uint64_t device, char* uuid, size_t uuid_size)
|
|||
/* resolve the link */
|
||||
pathprint(path, sizeof(path), "/dev/disk/by-uuid/%s", dd->d_name);
|
||||
ret = readlink(path, buf, sizeof(buf));
|
||||
if (ret < 0 || ret == sizeof(buf)) {
|
||||
if (ret < 0 || ret >= PATH_MAX) {
|
||||
log_tag("uuid:by-uuid:%u:%u: readlink(/dev/disk/by-uuid/%s) failed, %s\n", major(device), minor(device), dd->d_name, strerror(errno));
|
||||
/* generic error, ignore and continue the search */
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue