diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-01-31 22:25:35 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-01-31 22:25:35 +0000 |
commit | 588475d783a52d61a2bf8807a16cbba243f246d1 (patch) | |
tree | 64b9fbb2895c2e3a8f5de40f8f8d70e83858ee40 /libexec | |
parent | b99f5f81c8cd57acc8f355380fc32d2fc4fcc291 (diff) |
The version of open in ld.so, _dl_open(), will return -errno instead of -1.
This is to avoid corrupting 'errno'. Handle this case in _dl_opendir().
This is also the case for _dl_fcntl(). ok deraadt@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/dir.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/ld.so/dir.c b/libexec/ld.so/dir.c index 8aff41bc4a6..5526612d02b 100644 --- a/libexec/ld.so/dir.c +++ b/libexec/ld.so/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.4 2002/07/24 04:11:10 deraadt Exp $ */ +/* $OpenBSD: dir.c,v 1.5 2003/01/31 22:25:34 drahn Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -67,13 +67,13 @@ _dl_opendir(name) int flags = DTF_HIDEW|DTF_NODUP; - if ((fd = _dl_open(name, O_RDONLY | O_NONBLOCK)) == -1) + if ((fd = _dl_open(name, O_RDONLY | O_NONBLOCK)) < 0) return (NULL); if (_dl_fstat(fd, &sb) || !S_ISDIR(sb.st_mode)) { _dl_close(fd); return (NULL); } - if (_dl_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 || + if (_dl_fcntl(fd, F_SETFD, FD_CLOEXEC) < 0 || (dirp = (DIR *)_dl_malloc(sizeof(DIR))) == NULL) { _dl_close(fd); return (NULL); |