Skip to content

Commit

Permalink
Use the correct mode for files in the migrated directory
Browse files Browse the repository at this point in the history
This change uses 0644 as the mode for files instead of 0755.
  • Loading branch information
lhchavez committed Dec 29, 2018
1 parent 0b91dc1 commit aa8cbcd
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cmd/omegaup-migrate-problem/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,22 @@ func main() {
if err != nil {
return errors.Wrapf(err, "failed to access %s", path)
}
if err := os.Chmod(path, originalStat.Mode()); err != nil {
return errors.Wrapf(err, "failed to chmod temporary directory %s", path)
if info.IsDir() {
if err := os.Chmod(path, originalStat.Mode()); err != nil {
return errors.Wrapf(
err,
"failed to chmod directory in temporary directory %s",
path,
)
}
} else {
if err := os.Chmod(path, 0644); err != nil {
return errors.Wrapf(
err,
"failed to chmod file in temporary directory %s",
path,
)
}
}
if err := os.Chown(
path,
Expand Down

0 comments on commit aa8cbcd

Please sign in to comment.