diff options
author | chenkang <kongchen28@gmail.com> | 2021-10-11 09:17:57 +0800 |
---|---|---|
committer | chenkang <kongchen28@gmail.com> | 2021-10-11 17:26:30 +0800 |
commit | dd5975f3d579e64493f9b005eb304b86c478829e (patch) | |
tree | 9754d8e23c6e337b8642df049b9177857813e946 /pkg/specgen/specgen.go | |
parent | ea868933e8c014ac52192f397f5dc1c3e8ee375a (diff) | |
download | podman-dd5975f3d579e64493f9b005eb304b86c478829e.tar.gz podman-dd5975f3d579e64493f9b005eb304b86c478829e.tar.bz2 podman-dd5975f3d579e64493f9b005eb304b86c478829e.zip |
Support readonly rootfs contains colon
Fix: https://github.com/containers/podman/issues/11913
Signed-off-by: chenkang <kongchen28@gmail.com>
Diffstat (limited to 'pkg/specgen/specgen.go')
-rw-r--r-- | pkg/specgen/specgen.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index dbb669291..07995b2df 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -552,10 +552,10 @@ func NewSpecGenerator(arg string, rootfs bool) *SpecGenerator { if rootfs { csc.Rootfs = arg // check if rootfs is actually overlayed - parts := strings.SplitN(csc.Rootfs, ":", 2) - if len(parts) > 1 && parts[1] == "O" { + lastColonIndex := strings.LastIndex(csc.Rootfs, ":") + if lastColonIndex != -1 && lastColonIndex+1 < len(csc.Rootfs) && csc.Rootfs[lastColonIndex+1:] == "O" { csc.RootfsOverlay = true - csc.Rootfs = parts[0] + csc.Rootfs = csc.Rootfs[:lastColonIndex] } } else { csc.Image = arg |