local: fix crash with --metadata on Android
Before this change we called statx which causes a SIGSYS: bad system call fault. After this we force Android to use fstatat Fixes #7006
This commit is contained in:
parent
f489b54fa0
commit
a6cf4989b6
1 changed files with 2 additions and 1 deletions
|
@ -5,6 +5,7 @@ package local
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ func (o *Object) readMetadataFromFile(m *fs.Metadata) (err error) {
|
||||||
// Check statx() is available as it was only introduced in kernel 4.11
|
// Check statx() is available as it was only introduced in kernel 4.11
|
||||||
// If not, fall back to fstatat() which was introduced in 2.6.16 which is guaranteed for all Go versions
|
// If not, fall back to fstatat() which was introduced in 2.6.16 which is guaranteed for all Go versions
|
||||||
var stat unix.Statx_t
|
var stat unix.Statx_t
|
||||||
if unix.Statx(unix.AT_FDCWD, ".", 0, unix.STATX_ALL, &stat) != unix.ENOSYS {
|
if runtime.GOOS != "android" && unix.Statx(unix.AT_FDCWD, ".", 0, unix.STATX_ALL, &stat) != unix.ENOSYS {
|
||||||
readMetadataFromFileFn = readMetadataFromFileStatx
|
readMetadataFromFileFn = readMetadataFromFileStatx
|
||||||
} else {
|
} else {
|
||||||
readMetadataFromFileFn = readMetadataFromFileFstatat
|
readMetadataFromFileFn = readMetadataFromFileFstatat
|
||||||
|
|
Loading…
Add table
Reference in a new issue