summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-09-25 21:56:21 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-09-25 21:56:21 +0000
commit7afdcc96dd59352c2870eca137c05b56ebc3fa91 (patch)
tree0de062743828c3908a29452011c16586ae94fa35 /libexec
parentaf71788caf7fe032198101c4779dacd2bc34a699 (diff)
dlerror(3) should clear _dl_errno; based on a patch from Bjorn Sandell.
Closes PR 3441; drahn@ OK
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/dlfcn.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c
index 752c70a2085..ded0396992b 100644
--- a/libexec/ld.so/dlfcn.c
+++ b/libexec/ld.so/dlfcn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dlfcn.c,v 1.31 2003/09/04 19:33:48 drahn Exp $ */
+/* $OpenBSD: dlfcn.c,v 1.32 2003/09/25 21:56:20 millert Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -235,28 +235,33 @@ _dl_unload_deps(elf_object_t *object)
const char *
dlerror(void)
{
+ const char *errmsg;
+
switch (_dl_errno) {
case 0: /* NO ERROR */
- return (NULL);
+ errmsg = NULL;
case DL_NOT_FOUND:
- return ("File not found");
+ errmsg = "File not found";
case DL_CANT_OPEN:
- return ("Can't open file");
+ errmsg = "Can't open file";
case DL_NOT_ELF:
- return ("File not an ELF object");
+ errmsg = "File not an ELF object";
case DL_CANT_OPEN_REF:
- return ("Can't open referenced object");
+ errmsg = "Can't open referenced object";
case DL_CANT_MMAP:
- return ("Can't map ELF object");
+ errmsg = "Can't map ELF object";
case DL_INVALID_HANDLE:
- return ("Invalid handle");
+ errmsg = "Invalid handle";
case DL_NO_SYMBOL:
- return ("Unable to resolve symbol");
+ errmsg = "Unable to resolve symbol";
case DL_INVALID_CTL:
- return ("Invalid dlctl() command");
+ errmsg = "Invalid dlctl() command";
default:
- return ("Unknown error");
+ errmsg = "Unknown error";
}
+
+ _dl_errno = 0;
+ return (errmsg);
}
void