mirror of https://github.com/minio/minio.git
update fsSimpleRenameFile contrib
This commit is contained in:
parent
764721e2c6
commit
39d681a04a
|
@ -320,9 +320,9 @@ func fsCreateFile(ctx context.Context, filePath string, reader io.Reader, falloc
|
||||||
return bytesWritten, nil
|
return bytesWritten, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renames source path to destination path, fails if the destination path
|
// Renames source path to destination path, creates all the
|
||||||
// parents are not already created.
|
// missing parents if they don't exist.
|
||||||
func fsSimpleRenameFile(ctx context.Context, sourcePath, destPath string) error {
|
func fsRenameFile(ctx context.Context, sourcePath, destPath string) error {
|
||||||
if err := checkPathLength(sourcePath); err != nil {
|
if err := checkPathLength(sourcePath); err != nil {
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return err
|
return err
|
||||||
|
@ -332,9 +332,9 @@ func fsSimpleRenameFile(ctx context.Context, sourcePath, destPath string) error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.Rename(sourcePath, destPath); err != nil {
|
if err := renameAll(sourcePath, destPath); err != nil {
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return osErrToFileErr(err)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -18,13 +18,14 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/minio/minio/cmd/logger"
|
"github.com/minio/minio/cmd/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Renames source path to destination path, creates all the
|
// Renames source path to destination path, fails if the destination path
|
||||||
// missing parents if they don't exist.
|
// parents are not already created.
|
||||||
func fsRenameFile(ctx context.Context, sourcePath, destPath string) error {
|
func fsSimpleRenameFile(ctx context.Context, sourcePath, destPath string) error {
|
||||||
if err := checkPathLength(sourcePath); err != nil {
|
if err := checkPathLength(sourcePath); err != nil {
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return err
|
return err
|
||||||
|
@ -34,9 +35,9 @@ func fsRenameFile(ctx context.Context, sourcePath, destPath string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := renameAll(sourcePath, destPath); err != nil {
|
if err := os.Rename(sourcePath, destPath); err != nil {
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return err
|
return osErrToFileErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue