Skip to content

Commit

Permalink
Mode permissions match fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lkarlslund committed Nov 9, 2023
1 parent 19dab09 commit 9ab5720
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ func (c *Client) Run(client *rpc.Client) error {
}
}

if !create_file && uint32(localfi.Mode)&^uint32(os.ModePerm) != remotefi.Permissions&^uint32(os.ModePerm) {
logger.Debug().Msgf("File %s is indicating type change from %X to %X, unlinking", localpath, uint32(localfi.Mode)&^uint32(os.ModePerm), remotefi.Permissions&^uint32(os.ModePerm))
if !create_file && uint32(localfi.Permissions)&^uint32(os.ModePerm) != uint32(remotefi.Permissions)&^uint32(os.ModePerm) {
logger.Debug().Msgf("File %s is indicating type change from %X to %X, unlinking", localpath, uint32(localfi.Permissions)&^uint32(os.ModePerm), remotefi.Permissions&^uint32(os.ModePerm))
err = os.Remove(localpath)
if err != nil {
logger.Error().Msgf("Error unlinking %s: %v", localpath, err)
Expand Down Expand Up @@ -301,6 +301,14 @@ func (c *Client) Run(client *rpc.Client) error {

transfersuccess := true

if create_file {
logger.Info().Msgf("Creating file %s", localpath)
} else if copy_verify_file {
logger.Info().Msgf("Updating/verifying file %s", localpath)
} else if apply_attributes {
logger.Info().Msgf("Applying attributes to file %s", localpath)
}

var localfile *os.File
if create_file {
if remotefi.Mode&fs.ModeDevice != 0 {
Expand Down

0 comments on commit 9ab5720

Please sign in to comment.