[PATCH] Add option to operate on symbolic links for sys::fs::remove() and sys::fs::status()
Argyrios Kyrtzidis
kyrtzidis at apple.com
Thu Mar 20 10:16:36 PDT 2014
On Mar 20, 2014, at 9:59 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> On 18 March 2014 16:41, Argyrios Kyrtzidis <kyrtzidis at apple.com> wrote:
>> This simplifies things a bit, please see the attached updated patch.
>>
>
> Thanks.
>
> Reading LockFileManager::readLockFile I noticed the stat+open sequence in
>
> error_code EC = sys::fs::status(LockFileName, Status, /*FollowLink=*/false);
> ...
> if (MemoryBuffer::getFile(LockFileName, MB)) {
>
> This is normally an antipattern. The operation should just be tried
> and any errors handled. The link can go invalid between the status and
> the open, so the error handling following getFile has to handle it
> already, no?
>
> I patched your patch to just try to open. Let me know what you think.
Yes, this seems better.
But isn’t the sys::fs::status change to allow stat’ing symlinks good in general ? Otherwise how is sys::fs::is_symlink() supposed to work, it doesn’t work currently.
>
> Cheers,
> Rafael
> <t.patch>
More information about the llvm-commits
mailing list