diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-10-06 17:57:12 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-10-06 17:57:12 +0000 |
commit | 5d53b4e16cf42ba5c7710e83f29307631838802c (patch) | |
tree | 1e5690be0918cb5e65272200b953bc6dc2e6be08 /lib/libc | |
parent | bce251279f10514cf1472dd1903fc9bb8da2794d (diff) |
fdopendir() needs to set dd_curpos so that an immediate telldir() works.
pointed out by and ok matthew@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/opendir.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index eb139effaae..86038754999 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opendir.c,v 1.24 2013/08/13 05:52:12 guenther Exp $ */ +/* $OpenBSD: opendir.c,v 1.25 2013/10/06 17:57:11 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -75,6 +75,9 @@ fdopendir(int fd) } dirp = __fdopendir(fd); if (dirp != NULL) { + /* Record current offset for immediate telldir() */ + dirp->dd_curpos = lseek(fd, 0, SEEK_CUR); + /* * POSIX doesn't require fdopendir() to set * FD_CLOEXEC, so it's okay for this to fail. |