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:
Warner Losh 1998-09-09 17:12:58 +00:00
parent a4c0f3bc90
commit 1508e89cc6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39013

View file

@ -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);