diff options
Diffstat (limited to 'lib/libc/gen/closedir.c')
-rw-r--r-- | lib/libc/gen/closedir.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libc/gen/closedir.c b/lib/libc/gen/closedir.c index 7315bcc1e41..48d2775d7ea 100644 --- a/lib/libc/gen/closedir.c +++ b/lib/libc/gen/closedir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: closedir.c,v 1.7 2006/04/01 18:06:59 otto Exp $ */ +/* $OpenBSD: closedir.c,v 1.8 2007/06/05 18:11:48 kurt Exp $ */ /* * Copyright (c) 1983, 1993 * Regents of the University of California. All rights reserved. @@ -42,17 +42,15 @@ int closedir(DIR *dirp) { int fd; - int ret; - if ((ret = _FD_LOCK(dirp->dd_fd, FD_READ, NULL)) != 0) - return (ret); + _MUTEX_LOCK(&dirp->dd_lock); fd = dirp->dd_fd; dirp->dd_fd = -1; dirp->dd_loc = 0; free(dirp->dd_td->td_locs); free(dirp->dd_buf); + _MUTEX_UNLOCK(&dirp->dd_lock); + _MUTEX_DESTROY(&dirp->dd_lock); free(dirp); - ret = close(fd); - _FD_UNLOCK(fd, FD_READ); - return (ret); + return (close(fd)); } |