mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-09 10:00:39 +00:00
Use size of structure rather than hard coded 256 in readlink. This change
either came from OpenBSD, or was inspired by work done there.
This commit is contained in:
parent
a4c0f3bc90
commit
1508e89cc6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39013
|
@ -457,7 +457,7 @@ get_dir(char *dirname, char *fmask, DirList **dir, int *n)
|
|||
if ((S_IFMT & status.st_mode) == S_IFLNK) { /* handle links */
|
||||
(*dir)[i].link = TRUE;
|
||||
stat(dire[j]->d_name, &status);
|
||||
nb = readlink(dire[j]->d_name, buf, 256);
|
||||
nb = readlink(dire[j]->d_name, buf, sizeof(dire[j]->d_name) - 1);
|
||||
if (nb == -1) {
|
||||
printf("get_dir(): Error reading link: %s\n", dire[j]->d_name);
|
||||
exit(-1);
|
||||
|
|
Loading…
Reference in a new issue