diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2022-07-25 17:10:27 +0200 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2022-07-26 14:45:12 -0400 |
commit | c3e0f8ebef13e107b179fb6cf867ca8902f3761a (patch) | |
tree | 3d10339c6e86f903af0fa60b282717ace2aa02ae /cmd/winpath | |
parent | e6ebfbd1e0106d8ddcf19a1ec3f97052592f49ad (diff) | |
download | podman-c3e0f8ebef13e107b179fb6cf867ca8902f3761a.tar.gz podman-c3e0f8ebef13e107b179fb6cf867ca8902f3761a.tar.bz2 podman-c3e0f8ebef13e107b179fb6cf867ca8902f3761a.zip |
machine: Fix check which is always true
Before making / mutable/immutable, podman-machine checks if the mount is
being done in /home or /mnt. However the current check is always going
to be true:
```
!strings.HasPrefix(mount.Target, "/home") || !strings.HasPrefix(mount.Target, "/mnt")
```
is false when mount.Target starts with "/home" and mount.Target starts
with "/mnt", which cannot happen at the same time.
The correct check is:
```
!strings.HasPrefix(mount.Target, "/home") && !strings.HasPrefix(mount.Target, "/mnt")
```
which can also be written as:
```
!(strings.HasPrefix(mount.Target, "/home") || strings.HasPrefix(mount.Target, "/mnt"))
```
The impact is not too bad, it results in extra 'chattr -i' calls which
should be unneeded.
[NO NEW TESTS NEEDED]
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Diffstat (limited to 'cmd/winpath')
0 files changed, 0 insertions, 0 deletions