projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
initialize before use
[unix-history]
/
usr
/
src
/
sys
/
kern
/
vfs_lookup.c
diff --git
a/usr/src/sys/kern/vfs_lookup.c
b/usr/src/sys/kern/vfs_lookup.c
index
d8172dd
..
5f7aba1
100644
(file)
--- a/
usr/src/sys/kern/vfs_lookup.c
+++ b/
usr/src/sys/kern/vfs_lookup.c
@@
-3,7
+3,7
@@
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)vfs_lookup.c 6.2
4
(Berkeley) %G%
+ * @(#)vfs_lookup.c 6.2
5
(Berkeley) %G%
*/
#include "param.h"
*/
#include "param.h"
@@
-1118,8
+1118,6
@@
dirempty(ip, parentino)
#define MINDIRSIZ (sizeof (struct dirtemplate) / 2)
for (off = 0; off < ip->i_size; off += dp->d_reclen) {
#define MINDIRSIZ (sizeof (struct dirtemplate) / 2)
for (off = 0; off < ip->i_size; off += dp->d_reclen) {
- if (dp->d_reclen <= 0)
- return (0);
error = rdwri(UIO_READ, ip, (caddr_t)dp, MINDIRSIZ,
off, 1, &count);
/*
error = rdwri(UIO_READ, ip, (caddr_t)dp, MINDIRSIZ,
off, 1, &count);
/*
@@
-1128,6
+1126,9
@@
dirempty(ip, parentino)
*/
if (error || count != 0)
return (0);
*/
if (error || count != 0)
return (0);
+ /* avoid infinite loops */
+ if (dp->d_reclen <= 0)
+ return (0);
/* skip empty entries */
if (dp->d_ino == 0)
continue;
/* skip empty entries */
if (dp->d_ino == 0)
continue;