*** empty log message ***
This commit is contained in:
@@ -10,5 +10,6 @@ register DIR *dirp;
|
||||
close(dirp->dd_fd);
|
||||
dirp->dd_fd = -1;
|
||||
dirp->dd_loc = 0;
|
||||
free(dirp);
|
||||
free(dirp->dd_buf);
|
||||
free((char *)dirp);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,21 @@ char *name;
|
||||
close (fd);
|
||||
return NULL;
|
||||
}
|
||||
if ((int) stbuf.st_size == stbuf.st_size &&
|
||||
(dirp->dd_buf = malloc((unsigned) stbuf.st_size))) {
|
||||
dirp->dd_bsize = stbuf.st_size;
|
||||
}
|
||||
else if (dirp->dd_buf = malloc(8*DIRBLKSIZ)) {
|
||||
dirp->dd_bsize = 8 * DIRBLKSIZ;
|
||||
}
|
||||
else if (dirp->dd_buf = malloc(DIRBLKSIZ)) {
|
||||
dirp->dd_bsize = DIRBLKSIZ;
|
||||
}
|
||||
else {
|
||||
close(fd);
|
||||
free((char *) dirp);
|
||||
return NULL;
|
||||
}
|
||||
dirp->dd_fd = fd;
|
||||
dirp->dd_loc = 0;
|
||||
return dirp;
|
||||
|
||||
@@ -27,7 +27,7 @@ register DIR *dirp;
|
||||
for (;;) {
|
||||
if (dirp->dd_loc == 0) {
|
||||
dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf,
|
||||
DIRBLKSIZ);
|
||||
dirp->dd_bsize);
|
||||
if (dirp->dd_size <= 0) {
|
||||
dirp->dd_size = 0;
|
||||
return NULL;
|
||||
|
||||
@@ -16,22 +16,18 @@ long loc;
|
||||
curloc = telldir(dirp);
|
||||
if (loc == curloc)
|
||||
return;
|
||||
base = loc & ~(DIRBLKSIZ - 1);
|
||||
offset = loc & (DIRBLKSIZ - 1);
|
||||
offset = loc % dirp->dd_bsize;
|
||||
base = loc - offset;
|
||||
if (dirp->dd_loc != 0 && offset != 0 &&
|
||||
(curloc & ~(DIRBLKSIZ-1)) == base) {
|
||||
(curloc - (curloc % dirp->dd_bsize)) == base) {
|
||||
dirp->dd_loc = offset;
|
||||
return;
|
||||
}
|
||||
(void) lseek(dirp->dd_fd, base, 0);
|
||||
dirp->dd_loc = 0;
|
||||
dirp->dd_size = 0;
|
||||
if (offset == 0)
|
||||
(void) readdir(dirp);
|
||||
else {
|
||||
while (dirp->dd_loc < offset) {
|
||||
if (readdir(dirp) == (struct direct *) 0)
|
||||
return;
|
||||
}
|
||||
while (dirp->dd_loc < offset) {
|
||||
if (readdir(dirp) == (struct direct *) 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user