Skip to content

Commit f0d2a53

Browse files
committed
Use existing sys/unix constants instead of our hardcoded ones
1 parent af213d6 commit f0d2a53

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

init/init.go renamed to init/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ func relocateRootFS() error {
6666
}
6767

6868
func main() {
69-
const ramfsMagic int64 = 0x858458f6
70-
const tmpfsMagic int64 = 0x01021994
7169
var sfs unix.Statfs_t
7270

7371
if err := unix.Statfs("/", &sfs); err != nil {
@@ -76,7 +74,7 @@ func main() {
7674

7775
// Some programs (e.g. runc) refuse to work if the rootfs is a tmpfs or ramfs.
7876
// So, we need to copy all the files into a new tmpfs and make it the new rootfs.
79-
if sfs.Type == ramfsMagic || sfs.Type == tmpfsMagic {
77+
if sfs.Type == unix.RAMFS_MAGIC || sfs.Type == unix.TMPFS_MAGIC {
8078
if err := relocateRootFS(); err != nil {
8179
log.Fatalf("Cannot relocate rootfs: %v", err)
8280
}

0 commit comments

Comments
 (0)