]> git.kaiwu.me - nginx.git/commitdiff
Win32: replaced NGX_EXDEV with more appropriate error code.
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 29 Mar 2016 06:52:15 +0000 (09:52 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 29 Mar 2016 06:52:15 +0000 (09:52 +0300)
Correct error code for NGX_EXDEV on Windows is ERROR_NOT_SAME_DEVICE,
"The system cannot move the file to a different disk drive".

Previously used ERROR_WRONG_DISK is about wrong diskette in the drive and
is not appropriate.

There is no real difference though, as MoveFile() is able to copy files
between disk drives, and will fail with ERROR_ACCESS_DENIED when asked
to copy directories.  The ERROR_NOT_SAME_DEVICE error is only used
by MoveFileEx() when called without the MOVEFILE_COPY_ALLOWED flag.

src/os/win32/ngx_errno.h

index 02245e440dbba536f4a5ee4bd539a129dc63f169..255a39d5348db23ad3a3a9d75a3e6a8523930fd8 100644 (file)
@@ -33,11 +33,7 @@ typedef DWORD                      ngx_err_t;
  */
 #define NGX_EEXIST                 ERROR_ALREADY_EXISTS
 #define NGX_EEXIST_FILE            ERROR_FILE_EXISTS
-/*
- * could not found cross volume directory move error code,
- * so use ERROR_WRONG_DISK as stub one
- */
-#define NGX_EXDEV                  ERROR_WRONG_DISK
+#define NGX_EXDEV                  ERROR_NOT_SAME_DEVICE
 #define NGX_ENOTDIR                ERROR_PATH_NOT_FOUND
 #define NGX_EISDIR                 ERROR_CANNOT_MAKE
 #define NGX_ENOSPC                 ERROR_DISK_FULL