[PATCH] Add option to operate on symbolic links for sys::fs::remove() and sys::fs::status()

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Mar 20 09:59:47 PDT 2014


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.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 3313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140320/dd3ffb2b/attachment.obj>


More information about the llvm-commits mailing list