File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ static tResult copyOperation(void) {
7575 hFind = FindFirstFile (DosDevicePath , & FindFileData );
7676 // GCOVR_EXCL_START
7777 if (hFind == INVALID_HANDLE_VALUE ) {
78- result = printLastError (_T ("Got invalid handle for %s" ), getReadableFilename (DosDevicePath ));
78+ result & = printLastError (_T ("Got invalid handle for %s" ), getReadableFilename (DosDevicePath ));
7979 }
8080 // GCOVR_EXCL_STOP
8181 else {
@@ -93,14 +93,16 @@ static tResult copyOperation(void) {
9393 if (result == eOk ) {
9494 // GCOVR_EXCL_START
9595 if (GetLastError () != ERROR_NO_MORE_FILES ) {
96- result = printLastError (_T ("Can't get next file" ));
96+ result & = printLastError (_T ("Can't get next file" ));
9797 }
9898 // GCOVR_EXCL_STOP
9999 }
100100
101101 StartOfSourceName [-1 ] = _T ('\0' );
102102 // close handle to file
103- FindClose (hFind );
103+ if (!FindClose (hFind )) {
104+ result &= printLastError (_T ("Can't close file search handle." ));
105+ }
104106 }
105107 }
106108 } else {
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ static tResult moveOperation(void) {
8888 hFind = FindFirstFile (DosDevicePath , & FindFileData );
8989 // GCOVR_EXCL_START
9090 if (hFind == INVALID_HANDLE_VALUE ) {
91- result = printLastError (_T ("Got invalid handle for %s" ), getReadableFilename (DosDevicePath ));
91+ result & = printLastError (_T ("Got invalid handle for %s" ), getReadableFilename (DosDevicePath ));
9292 }
9393 // GCOVR_EXCL_STOP
9494 else {
@@ -108,16 +108,16 @@ static tResult moveOperation(void) {
108108 // We are at the end of the list
109109 // GCOVR_EXCL_START
110110 if (GetLastError () != ERROR_NO_MORE_FILES ) {
111- result = printLastError (_T ("Can't get next file" ));
111+ result & = printLastError (_T ("Can't get next file" ));
112112 }
113113 // GCOVR_EXCL_STOP
114- else {
115- removeEmptyDirectory (DosDevicePath );
116- }
117114 }
118115
119116 // close handle to file
120- FindClose (hFind );
117+ if (!FindClose (hFind )) {
118+ result &= printLastError (_T ("Can't close file search handle." ));
119+ }
120+ removeEmptyDirectory (DosDevicePath );
121121 }
122122 }
123123 }
Original file line number Diff line number Diff line change @@ -150,10 +150,10 @@ test_fileop_check_filesystem(
150150)
151151
152152test_fileop_check_filesystem (
153- NAME MoveFileExistingTargetDashDash
154- DEPENDS MoveFileExistingTarget
155- PREPARE_COMMAND sh -c "touch -- --target && chmod -R oga-w -- --target MoveFileToDirectory/dir/--target "
156- ARGS move --force -- --target MoveFileToDirectory/dir/
157- MUST_NOT_EXIST --target
158- MUST_EXIST MoveFileToDirectory/dir/--target
153+ NAME MoveDirectoryRecursive
154+ DEPENDS MoveFileExistingTargetForce
155+ PREPARE_COMMAND sh -c "mkdir -p MoveFileToDirectory/Target/dir && chmod -R oga-w MoveFileToDirectory"
156+ ARGS --debug move --force --touch --time 2003-01-01 -- target-directory MoveFileToDirectory/Target MoveFileToDirectory/dir
157+ MUST_EXIST MoveFileToDirectory/Target/dir/ --target
158+ MUST_NOT_EXIST MoveFileToDirectory/dir
159159)
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ static tResult removeOperation(void) {
4444 hFind = FindFirstFile (DosDevicePath , & FindFileData );
4545 // GCOVR_EXCL_START
4646 if (hFind == INVALID_HANDLE_VALUE ) {
47- result = printLastError (_T ("Got invalid handle for %s" ), getReadableFilename (DosDevicePath ));
47+ result & = printLastError (_T ("Got invalid handle for %s" ), getReadableFilename (DosDevicePath ));
4848 }
4949 // GCOVR_EXCL_STOP
5050 else {
@@ -62,14 +62,16 @@ static tResult removeOperation(void) {
6262 if (result == eOk ) {
6363 // GCOVR_EXCL_START
6464 if (GetLastError () != ERROR_NO_MORE_FILES ) {
65- result = printLastError (_T ("Can't get next file" ));
65+ result & = printLastError (_T ("Can't get next file" ));
6666 }
6767 // GCOVR_EXCL_STOP
6868 }
6969
7070 StartOfName [-1 ] = _T ('\0' );
7171 // close handle to file
72- FindClose (hFind );
72+ if (!FindClose (hFind )) {
73+ result &= printLastError (_T ("Can't close file search handle." ));
74+ }
7375 }
7476 }
7577
You can’t perform that action at this time.
0 commit comments