summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-03-10 22:27:51 +0000
committerpeter <peter@FreeBSD.org>1996-03-10 22:27:51 +0000
commitf7d16bb60b381a2f1ae4e1d204eec150ec5dbb4a (patch)
tree4b55b125e3c32e63473442161018b2043484340f /sys/compat
parentc08735130595cce051009ba5b093677bf7c46e0a (diff)
downloadFreeBSD-src-f7d16bb60b381a2f1ae4e1d204eec150ec5dbb4a.zip
FreeBSD-src-f7d16bb60b381a2f1ae4e1d204eec150ec5dbb4a.tar.gz
Fix the getdents() emulation, the Linux ELF libraries use this, and
this code was not quite right (linux has a readdir and getdents syscall, with the same args. readdir only returns one entry and uses a mutant dirent structure. This code was also returning the mutant form for getdents as well. My fault for missing this before.)
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_file.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 93932df..bf28b2c 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_file.c,v 1.5 1995/12/15 03:06:50 peter Exp $
+ * $Id: linux_file.c,v 1.6 1996/03/02 19:37:53 peter Exp $
*/
#include <sys/param.h>
@@ -497,8 +497,16 @@ again:
break;
}
linux_dirent.dino = (long) bdp->d_fileno;
- linux_dirent.doff = (linux_off_t) linuxreclen;
- linux_dirent.dreclen = (u_short) bdp->d_namlen;
+ if (justone) {
+ /*
+ * old linux-style readdir usage.
+ */
+ linux_dirent.doff = (linux_off_t) linuxreclen;
+ linux_dirent.dreclen = (u_short) bdp->d_namlen;
+ } else {
+ linux_dirent.doff = (linux_off_t) off;
+ linux_dirent.dreclen = (u_short) linuxreclen;
+ }
strcpy(linux_dirent.dname, bdp->d_name);
if ((error = copyout((caddr_t)&linux_dirent, outp, linuxreclen))) {
goto out;
OpenPOWER on IntegriCloud