summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2014-07-06 18:26:58 +0000
committerotto <otto@openbsd.org>2014-07-06 18:26:58 +0000
commitdbee36e7f0c54e14b78ae5818f4997fcf91b6f91 (patch)
treed67fe2bd7fc4a7d6f280dba51752a7557b884cb1
parentenable -Wall, explicitly call _dl_strsep, and zap some redundant includes (diff)
downloadwireguard-openbsd-dbee36e7f0c54e14b78ae5818f4997fcf91b6f91.tar.xz
wireguard-openbsd-dbee36e7f0c54e14b78ae5818f4997fcf91b6f91.zip
int all fields, so calloc can become malloc; ok miod@
-rw-r--r--libexec/ld.so/dir.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/ld.so/dir.c b/libexec/ld.so/dir.c
index e7408f271cb..7b1e220a2e7 100644
--- a/libexec/ld.so/dir.c
+++ b/libexec/ld.so/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.19 2014/07/06 17:33:10 otto Exp $ */
+/* $OpenBSD: dir.c,v 1.20 2014/07/06 18:26:58 otto Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -67,11 +67,14 @@ _dl_opendir(const char *name)
return (NULL);
}
if (_dl_fcntl(fd, F_SETFD, FD_CLOEXEC) < 0 ||
- (dirp = _dl_calloc(1, sizeof(*dirp))) == NULL) {
+ (dirp = _dl_malloc(sizeof(*dirp))) == NULL) {
_dl_close(fd);
return (NULL);
}
+ dirp->dd_fd = fd;
+ dirp->dd_loc = 0;
+ dirp->dd_size = 0;
dirp->dd_len = _dl_round_page(sb.st_blksize);
dirp->dd_buf = _dl_malloc(dirp->dd_len);
if (dirp->dd_buf == NULL) {
@@ -79,8 +82,6 @@ _dl_opendir(const char *name)
_dl_close (fd);
return (NULL);
}
- dirp->dd_loc = 0;
- dirp->dd_fd = fd;
return (dirp);
}