Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2025 16:55:21 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ed955671d2e8 - main - libc: use __sys___realpathat directly in realpath
Message-ID:  <202502191655.51JGtLvS039285@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=ed955671d2e844f274dd8245aa3c5c7e9dcdc77a

commit ed955671d2e844f274dd8245aa3c5c7e9dcdc77a
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-02-19 16:52:04 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-02-19 16:55:04 +0000

    libc: use __sys___realpathat directly in realpath
    
    We don't need to use an interposable symbol for this purpose and it's
    simpler to just call the syscall in libsys.  This resolves a bug where
    we were incorrectly using __realpathat in libc not libsys.
    
    While here, drop support for running on a FreeBSD 12 kernel and simplify
    includes.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D49048
---
 lib/libc/stdlib/realpath.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index 28348ea9e226..4c52b73319ab 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -28,21 +28,16 @@
  * SUCH DAMAGE.
  */
 
-#include "namespace.h"
 #include <sys/param.h>
 #include <sys/stat.h>
 
 #include <errno.h>
 #include <fcntl.h>
+#include <libsys.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <ssp/ssp.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-
-extern int __realpathat(int fd, const char *path, char *buf, size_t size,
-    int flags);
 
 /*
  * Find the real name of path, by removing all ".", ".." and symlink
@@ -224,9 +219,8 @@ __ssp_real(realpath)(const char * __restrict path, char * __restrict resolved)
 		if (resolved == NULL)
 			return (NULL);
 	}
-	if (__getosreldate() >= 1300080) {
-		if (__realpathat(AT_FDCWD, path, resolved, PATH_MAX, 0) == 0)
-			return (resolved);
+	if (__sys___realpathat(AT_FDCWD, path, resolved, PATH_MAX, 0) == 0) {
+		return (resolved);
 	}
 	res = realpath1(path, resolved);
 	if (res == NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502191655.51JGtLvS039285>