re: Running o32 code on n32 (Part 2, fancier programs)

matthew green <[email protected]>
Newsgroups gmane.os.netbsd.ports.mips.devel
Message-ID <[email protected]>
> there's an infinite loop in readdir(3).  what i guess is happening is
> that each run through the loop dp->d_reclen is 0, so that the value
> of dirp->dd_loc always remains 0.  so, something is wrong here, but
> i don't see it in a simple test case (i haven't gotten pkgsrc on my
> gxemul system yet.)

can you see what happens with this patch?  thanks.  i don't think
we should commit this, but figure out why it's happening, but it
will at least confirm the problem i'm guessing.


.mrg.


Index: gen/readdir.c
===================================================================
RCS file: /cvsroot/src/lib/libc/gen/readdir.c,v
retrieving revision 1.26
diff -p -u -r1.26 readdir.c
--- gen/readdir.c	25 Jun 2012 22:32:43 -0000	1.26
+++ gen/readdir.c	10 Oct 2016 17:39:59 -0000
@@ -78,6 +78,8 @@ _readdir_unlocked(DIR *dirp, int skipdel
 		/* d_reclen is unsigned; no need to compare it <= 0 */
 		if (dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc)
 			return (NULL);
+		if (dp->d_reclen == 0)
+			return (NULL);
 		dirp->dd_loc += dp->d_reclen;
 		if (dp->d_ino == 0 && skipdeleted)
 			continue;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.