]> Kevux Git Server - fll/commit
Update: Improve the logic for the read link f_file functions.
authorKevin Day <thekevinday@gmail.com>
Sat, 16 Apr 2022 05:01:06 +0000 (00:01 -0500)
committerKevin Day <thekevinday@gmail.com>
Sat, 16 Apr 2022 05:01:06 +0000 (00:01 -0500)
commitac5442912f85386c92d9c7cd05d1ed5e8b1f0012
treee8ac28f5cf94bc47cc5635f14c1b6af4779e7d41
parent141076fdff1fa6a918eb4d276c95f94b92c31771
Update: Improve the logic for the read link f_file functions.

The f_file_link_read() and f_file_link_read_at() functions have their dynamic allocation logic improved.
Use link_stat.st_size rather than target->used to pass to readlink() or readlinkat().

Initialize target->used to 0 and then update target->used on success while ensuring the string is always NULL terminated after the target->used.

The unit tests revealed that these can and should be improved.
level_0/f_file/c/file.h
level_0/f_file/c/private-file.c
level_0/f_file/c/private-file.h