PERFORCE change 108581 for review
Marcel Moolenaar
marcel at FreeBSD.org
Fri Oct 27 23:51:24 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=108581
Change 108581 by marcel at marcel_cluster on 2006/10/27 23:50:59
Fix efifs_readdir():
o The Read() function returns success at EOF, but returns a
size of 0.
o Determine d_namlen based on how many characters we copied.
Affected files ...
.. //depot/projects/ia64/sys/boot/efi/libefi/efifs.c#11 edit
Differences ...
==== //depot/projects/ia64/sys/boot/efi/libefi/efifs.c#11 (text+ko) ====
@@ -43,7 +43,7 @@
union fileinfo {
EFI_FILE_INFO info;
- char bytes[sizeof(EFI_FILE_INFO) + 510];
+ char bytes[sizeof(EFI_FILE_INFO) + 508];
};
static EFI_GUID sfs_guid = SIMPLE_FILE_SYSTEM_PROTOCOL;
@@ -299,6 +299,8 @@
status = file->Read(file, &sz, &fi);
if (EFI_ERROR(status))
return (status_to_errno(status));
+ if (sz == 0)
+ return (ENOENT);
d->d_fileno = 0;
d->d_reclen = sizeof(*d);
@@ -306,10 +308,10 @@
d->d_type = DT_DIR;
else
d->d_type = DT_REG;
- d->d_namlen = (fi.info.Size - sizeof(EFI_FILE_INFO)) / sizeof(CHAR16);
- for (i = 0; i < d->d_namlen; i++)
+ for (i = 0; fi.info.FileName[i] != 0; i++)
d->d_name[i] = fi.info.FileName[i];
d->d_name[i] = 0;
+ d->d_namlen = i;
return (0);
}
More information about the p4-projects
mailing list