Jason Edmeades : xcopy: Return code 1 for no files is never returned.

Alexandre Julliard julliard at winehq.org
Wed Jun 27 16:04:36 CDT 2018


Module: wine
Branch: master
Commit: 8a84148e5248c346911b4cfb9974da6b9949136a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8a84148e5248c346911b4cfb9974da6b9949136a

Author: Jason Edmeades <us at edmeades.me.uk>
Date:   Sun Jun 24 21:44:13 2018 +0100

xcopy: Return code 1 for no files is never returned.

Signed-off-by: Jason Edmeades <us at edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/xcopy/tests/xcopy.c | 4 +---
 programs/xcopy/xcopy.c       | 7 ++++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/programs/xcopy/tests/xcopy.c b/programs/xcopy/tests/xcopy.c
index 7ca32d6..0991d49 100644
--- a/programs/xcopy/tests/xcopy.c
+++ b/programs/xcopy/tests/xcopy.c
@@ -97,17 +97,15 @@ static void test_parms_syntax(void)
     DeleteFileA("xcopytest\\xcopy1"); */
 
     rc = runcmd("xcopy /D/S xcopytest xcopytest2\\");
-    todo_wine
     ok(rc == 0, "xcopy /D/S test failed rc=%u\n", rc);
     ok(GetFileAttributesA("xcopytest2") == INVALID_FILE_ATTRIBUTES,
        "xcopy copied empty directory incorrectly\n");
 
     rc = runcmd("xcopy /D/S/E xcopytest xcopytest2\\");
-    todo_wine {
     ok(rc == 0, "xcopy /D/S/E test failed rc=%u\n", rc);
+    todo_wine
     ok(GetFileAttributesA("xcopytest2") != INVALID_FILE_ATTRIBUTES,
        "xcopy failed to copy empty directory\n");
-    }
     RemoveDirectoryA("xcopytest2");
 }
 
diff --git a/programs/xcopy/xcopy.c b/programs/xcopy/xcopy.c
index 461104a..97b0538 100644
--- a/programs/xcopy/xcopy.c
+++ b/programs/xcopy/xcopy.c
@@ -31,12 +31,14 @@
 
 /*
  * Notes:
- * Apparently, valid return codes are:
+ * Documented valid return codes are:
  *   0 - OK
- *   1 - No files found to copy
+ *   1 - No files found to copy  (*1)
  *   2 - CTRL+C during copy
  *   4 - Initialization error, or invalid source specification
  *   5 - Disk write error
+ *
+ * (*1) Testing shows return code 1 is never returned
  */
 
 
@@ -1165,7 +1167,6 @@ int wmain (int argc, WCHAR *argvW[])
     } else if (!(flags & OPT_NOCOPY)) {
         XCOPY_wprintf(XCOPY_LoadMessage(STRING_COPY), filesCopied);
     }
-    if (rc == RC_OK && filesCopied == 0) rc = RC_NOFILES;
     return rc;
 
 }




More information about the wine-cvs mailing list