Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c)

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: petar(at)smokva(dot)net, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c)
Date: 2018-03-17 19:59:30
Message-ID: 87efkih4gi.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

>> On systems with openat(), would it not be possible to resolve
>> symlinks without ever needing chdir?

Tom> Um ... AFAICS, openat() just opens a file, it doesn't give back a
Tom> resolved path. Did you mean readlinkat()?

No, what I meant was that if you have openat() (and fstatat() and
fdopendir()), you can do what getcwd does except starting with some
arbitrary directory other than the current one. So the current logic of
"chdir through all symlinks, then do getcwd to find where we landed"
would not be necessary.

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Christoph Berg 2018-03-17 20:40:51 Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c)
Previous Message Petar Bogdanovic 2018-03-17 19:00:58 Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c)