address use-after-move lint

Summary:
From D56593397:

'channel' used after it was moved
fbcode/eden/fs/inodes/EdenMount.cpp:2046:43: move occurred here

```
                              channel_2 = std::move(channel)](
                                          ^
```

fbcode/eden/fs/inodes/EdenMount.cpp:2040:25: the use and move are unsequenced, i.e. there is no guarantee about the order in which they are evaluated

```
                        channel->getAddr(),
                        ^
```

Reviewed By: jdelliot

Differential Revision: D56645977

fbshipit-source-id: b12ff23e0eca8e5d6092e871a2cbcd1b3689d66c
This commit is contained in:
Michael Cuevas 2024-04-30 20:19:12 -07:00 committed by Facebook GitHub Bot
parent 096cc64769
commit 3115bb363d

View File

@ -2032,12 +2032,15 @@ folly::Future<folly::Unit> EdenMount::fsChannelMount(bool readOnly) {
NfsServer::NfsMountInfo mountInfo) mutable {
auto [channel, mountdAddr] = std::move(mountInfo);
#ifndef _WIN32
// Channel is later moved. We must assign addr to a local var
// to avoid the possibility of a use-after-move bug.
auto addr = channel->getAddr();
// TODO: teach privhelper or something to mount on Windows
return serverState_->getPrivHelper()
->nfsMount(
mountPath.view(),
mountdAddr,
channel->getAddr(),
addr,
readOnly,
iosize,
useReaddirplus)