Re: psql \ir filename normalization - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: psql \ir filename normalization
Date
Msg-id 201111211805.pALI57V25371@momjian.us
Whole thread Raw
In response to Re: psql \ir filename normalization  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: psql \ir filename normalization
List pgsql-hackers
Robert Haas wrote:
> Argh.  The root of the problem here seems to be that
> join_path_components() feels entitled to arbitrarily insert a pathname
> separator at the front of the output string even if its first input
> didn't begin with one originally.  Lame!

The attached patch fixes this report, I think.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/src/port/path.c b/src/port/path.c
new file mode 100644
index 13ca4f3..9cb0b01
*** a/src/port/path.c
--- b/src/port/path.c
*************** join_path_components(char *ret_path,
*** 212,218 ****
      }
      if (*tail)
          snprintf(ret_path + strlen(ret_path), MAXPGPATH - strlen(ret_path),
!                  "/%s", tail);
  }


--- 212,219 ----
      }
      if (*tail)
          snprintf(ret_path + strlen(ret_path), MAXPGPATH - strlen(ret_path),
!                 /* only add slash if there is something already in head */
!                  "%s%s", head[0] ? "/" : "", tail);
  }



pgsql-hackers by date:

Previous
From: Joshua Berkus
Date:
Subject: Re: ISN was: Core Extensions relocation
Next
From: Bruce Momjian
Date:
Subject: Re: Client library cross-compiling: Win32, Win64, MacOSX. Possible?