local: fix incorrect conversion between integer types
This commit is contained in:
parent
1e14523b82
commit
c8366dfef3
1 changed files with 6 additions and 3 deletions
|
@ -2,6 +2,7 @@ package local
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -128,9 +129,11 @@ func (o *Object) writeMetadataToFile(m fs.Metadata) (outErr error) {
|
||||||
}
|
}
|
||||||
mode, hasMode := o.parseMetadataInt(m, "mode", 8)
|
mode, hasMode := o.parseMetadataInt(m, "mode", 8)
|
||||||
if hasMode {
|
if hasMode {
|
||||||
err = os.Chmod(o.path, os.FileMode(mode))
|
if mode >= 0 && uint(mode) <= math.MaxUint32 {
|
||||||
if err != nil {
|
err = os.Chmod(o.path, os.FileMode(mode))
|
||||||
outErr = fmt.Errorf("failed to change permissions: %w", err)
|
if err != nil {
|
||||||
|
outErr = fmt.Errorf("failed to change permissions: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// FIXME not parsing rdev yet
|
// FIXME not parsing rdev yet
|
||||||
|
|
Loading…
Reference in a new issue