Date: Sat, 23 Mar 2024 12:53:06 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 277906] libalias fails to report an error from dlsym() Message-ID: <bug-277906-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277906 Bug ID: 277906 Summary: libalias fails to report an error from dlsym() Product: Base System Version: 14.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: Igor.Gusarov@kaspersky.com The following code can be found in file /usr/src/sys/netinet/libalias/alias= .c around line 1715 p =3D dlsym(handle, "alias_mod"); if ((error =3D dlerror()) !=3D NULL) { fprintf(stderr, "%s\n", dlerror()); return (EINVAL); } This code calls dlerror() function twice: first time to check if there is an error, and the second time to print that error. Such approach is wrong, as described in manual page for dlerror(3): > At each call > to dlerror(), the error indication is reset. Thus in the case of two > calls to dlerror(), where the second call follows the first immediately, > the second call will always return a null pointer. Which may result in the following not helpful error message when trying to start natd: # service natd restart Stopping natd. Waiting for PIDS: 23950. Starting natd. (null) <--- Here. This null message is printed at alias.c:1715 #=20 Suggested fix: Apply the following patch to /usr/src/sys/netinet/libalias/alias.c --- alias.c 2023-11-10 03:07:53.000000000 +0300 +++ alias.c.new 2024-03-23 15:48:15.335314000 +0300 @@ -1712,7 +1712,7 @@ p =3D dlsym(handle, "alias_mod"); if ((error =3D dlerror()) !=3D NULL) { - fprintf(stderr, "%s\n", dlerror()); + fprintf(stderr, "%s\n", error); return (EINVAL); } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277906-227>