mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct: fix mips compilation
On MIPS arches, Rdev is uint32 so we have to convert it. Fixes issue 4962. Fixes:8476df83("libct: add/use isDevNull, verifyDevNull") Fixes:de87203e("console: verify /dev/pts/ptmx before use") Fixes:398955bc("console: add fallback for pre-TIOCGPTPEER kernels") Reported-by: Tianon Gravi <admwiggin@gmail.com> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -1044,10 +1044,10 @@ func mknodDevice(destDir *os.File, destName string, node *devices.Device) error
|
||||
node.Type, node.Path,
|
||||
stat.Mode&unix.S_IFMT, fileMode&unix.S_IFMT)
|
||||
}
|
||||
if stat.Rdev != dev {
|
||||
if rdev := uint64(stat.Rdev); rdev != dev { //nolint:unconvert // Rdev is uint32 on MIPS.
|
||||
return fmt.Errorf("new %c device inode %s has incorrect major:minor: %d:%d doesn't match expected %d:%d",
|
||||
node.Type, node.Path,
|
||||
unix.Major(stat.Rdev), unix.Minor(stat.Rdev),
|
||||
unix.Major(rdev), unix.Minor(rdev),
|
||||
unix.Major(dev), unix.Minor(dev))
|
||||
}
|
||||
return nil
|
||||
@@ -1318,7 +1318,8 @@ func remountReadonly(m *configs.Mount) error {
|
||||
}
|
||||
|
||||
func isDevNull(st *unix.Stat_t) bool {
|
||||
return st.Mode&unix.S_IFMT == unix.S_IFCHR && st.Rdev == unix.Mkdev(1, 3)
|
||||
//nolint:unconvert // Rdev is uint32 on MIPS.
|
||||
return st.Mode&unix.S_IFMT == unix.S_IFCHR && uint64(st.Rdev) == unix.Mkdev(1, 3)
|
||||
}
|
||||
|
||||
func verifyDevNull(f *os.File) error {
|
||||
|
||||
Reference in New Issue
Block a user