Skip to content

Commit 5648663

Browse files
author
Mrunal Patel
authored
Merge pull request #1024 from WeiZhang555/tiny-refactor
Tiny refactor: remove unused local variables
2 parents 7b0b628 + 7303a9a commit 5648663

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

libcontainer/specconv/spec_linux.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -625,18 +625,15 @@ func parseMountOptions(options []string) (int, []int, string) {
625625
"suid": {true, syscall.MS_NOSUID},
626626
"sync": {false, syscall.MS_SYNCHRONOUS},
627627
}
628-
propagationFlags := map[string]struct {
629-
clear bool
630-
flag int
631-
}{
632-
"private": {false, syscall.MS_PRIVATE},
633-
"shared": {false, syscall.MS_SHARED},
634-
"slave": {false, syscall.MS_SLAVE},
635-
"unbindable": {false, syscall.MS_UNBINDABLE},
636-
"rprivate": {false, syscall.MS_PRIVATE | syscall.MS_REC},
637-
"rshared": {false, syscall.MS_SHARED | syscall.MS_REC},
638-
"rslave": {false, syscall.MS_SLAVE | syscall.MS_REC},
639-
"runbindable": {false, syscall.MS_UNBINDABLE | syscall.MS_REC},
628+
propagationFlags := map[string]int{
629+
"private": syscall.MS_PRIVATE,
630+
"shared": syscall.MS_SHARED,
631+
"slave": syscall.MS_SLAVE,
632+
"unbindable": syscall.MS_UNBINDABLE,
633+
"rprivate": syscall.MS_PRIVATE | syscall.MS_REC,
634+
"rshared": syscall.MS_SHARED | syscall.MS_REC,
635+
"rslave": syscall.MS_SLAVE | syscall.MS_REC,
636+
"runbindable": syscall.MS_UNBINDABLE | syscall.MS_REC,
640637
}
641638
for _, o := range options {
642639
// If the option does not exist in the flags table or the flag
@@ -648,8 +645,8 @@ func parseMountOptions(options []string) (int, []int, string) {
648645
} else {
649646
flag |= f.flag
650647
}
651-
} else if f, exists := propagationFlags[o]; exists && f.flag != 0 {
652-
pgflag = append(pgflag, f.flag)
648+
} else if f, exists := propagationFlags[o]; exists && f != 0 {
649+
pgflag = append(pgflag, f)
653650
} else {
654651
data = append(data, o)
655652
}

0 commit comments

Comments
 (0)