Fix bogus length restriction on readlink. Use sizeof(buf) - 1 rather

than the size of the directory name.  Fix style bug which increased
the number of lines > 80 characters by one.

Pointed out by: bde
This commit is contained in:
Warner Losh 1998-09-10 16:14:29 +00:00
parent 9646002cc5
commit 486a7ab25b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39052

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, sizeof(dire[j]->d_name) - 1);
nb = readlink(dire[j]->d_name, buf, sizeof(buf) - 1);
if (nb == -1) {
printf("get_dir(): Error reading link: %s\n", dire[j]->d_name);
exit(-1);