From be1d6256c60d6684f0e265a913ffa7aec18a039a Mon Sep 17 00:00:00 2001 From: "Magomed Kostoev (mkostoevr)" Date: Thu, 30 Apr 2020 11:01:55 +0000 Subject: [PATCH] Second call of dlerror should return NULL by the POSIX standard. git-svn-id: svn://kolibrios.org@7851 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/ktcc/trunk/libc/dlfcn/dlfcn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/programs/develop/ktcc/trunk/libc/dlfcn/dlfcn.c b/programs/develop/ktcc/trunk/libc/dlfcn/dlfcn.c index c6f8076ea..e5b1768e0 100644 --- a/programs/develop/ktcc/trunk/libc/dlfcn/dlfcn.c +++ b/programs/develop/ktcc/trunk/libc/dlfcn/dlfcn.c @@ -85,5 +85,7 @@ int dlclose(void *handle) { // https://pubs.opengroup.org/onlinepubs/007908799/xsh/dlerror.html char *dlerror(void) { - return strdup(__error); + char *ret = __error ? strdup(__error) : NULL; + __error = NULL; + return ret; }