Skip to content

Commit

Permalink
local: fix crash with --metadata on Android
Browse files Browse the repository at this point in the history
Before this change we called statx which causes a

    SIGSYS: bad system call

fault.

After this we force Android to use fstatat

Fixes rclone#7006
  • Loading branch information
ncw committed May 17, 2023
1 parent f489b54 commit a6cf498
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/local/metadata_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package local

import (
"fmt"
"runtime"
"sync"
"time"

Expand All @@ -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
// 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
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
} else {
readMetadataFromFileFn = readMetadataFromFileFstatat
Expand Down

0 comments on commit a6cf498

Please sign in to comment.