public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Remove support for old realpath() API
Date: Mon, 5 Aug 2024 08:12:30 +0200
Message-ID: <[email protected]> (raw)

The now preferred way to call realpath() is by passing NULL as the
second argument and get a malloc'ed result.  We still supported the
old way of providing our own buffer as a second argument, for some
platforms that didn't support the new way yet.  Those were only
Solaris less than version 11 and some older AIX versions (7.1 and
newer appear to support the new variant).  We don't support those
platforms versions anymore, so we can remove this extra code.
From aba5b5b6017eff0baa59698de665058843fe1d05 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Mon, 5 Aug 2024 07:50:27 +0200
Subject: [PATCH] Remove support for old realpath() API

The now preferred way to call realpath() is by passing NULL as the
second argument and get a malloc'ed result.  We still supported the
old way of providing our own buffer as a second argument, for some
platforms that didn't support the new way yet.  Those were only
Solaris less than version 11 and some older AIX versions (7.1 and
newer appear to support the new variant).  We don't support those
platforms versions anymore, so we can remove this extra code.
---
 src/common/exec.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/src/common/exec.c b/src/common/exec.c
index 0bee19c1e53..32fd56532aa 100644
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -285,25 +285,6 @@ pg_realpath(const char *fname)
 
 #ifndef WIN32
 	path = realpath(fname, NULL);
-	if (path == NULL && errno == EINVAL)
-	{
-		/*
-		 * Cope with old-POSIX systems that require a user-provided buffer.
-		 * Assume MAXPGPATH is enough room on all such systems.
-		 */
-		char	   *buf = malloc(MAXPGPATH);
-
-		if (buf == NULL)
-			return NULL;		/* assume errno is set */
-		path = realpath(fname, buf);
-		if (path == NULL)		/* don't leak memory */
-		{
-			int			save_errno = errno;
-
-			free(buf);
-			errno = save_errno;
-		}
-	}
 #else							/* WIN32 */
 
 	/*
-- 
2.46.0



Attachments:

  [text/plain] 0001-Remove-support-for-old-realpath-API.patch (1.5K, ../[email protected]/2-0001-Remove-support-for-old-realpath-API.patch)
  download | inline diff:
From aba5b5b6017eff0baa59698de665058843fe1d05 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Mon, 5 Aug 2024 07:50:27 +0200
Subject: [PATCH] Remove support for old realpath() API

The now preferred way to call realpath() is by passing NULL as the
second argument and get a malloc'ed result.  We still supported the
old way of providing our own buffer as a second argument, for some
platforms that didn't support the new way yet.  Those were only
Solaris less than version 11 and some older AIX versions (7.1 and
newer appear to support the new variant).  We don't support those
platforms versions anymore, so we can remove this extra code.
---
 src/common/exec.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/src/common/exec.c b/src/common/exec.c
index 0bee19c1e53..32fd56532aa 100644
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -285,25 +285,6 @@ pg_realpath(const char *fname)
 
 #ifndef WIN32
 	path = realpath(fname, NULL);
-	if (path == NULL && errno == EINVAL)
-	{
-		/*
-		 * Cope with old-POSIX systems that require a user-provided buffer.
-		 * Assume MAXPGPATH is enough room on all such systems.
-		 */
-		char	   *buf = malloc(MAXPGPATH);
-
-		if (buf == NULL)
-			return NULL;		/* assume errno is set */
-		path = realpath(fname, buf);
-		if (path == NULL)		/* don't leak memory */
-		{
-			int			save_errno = errno;
-
-			free(buf);
-			errno = save_errno;
-		}
-	}
 #else							/* WIN32 */
 
 	/*
-- 
2.46.0



view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Remove support for old realpath() API
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox