Commit ff1e7038 authored by Dan Kegel's avatar Dan Kegel Committed by Alexandre Julliard

cmd: del /a: test deleting readonly files, with fix.

parent 65b27c9e
......@@ -712,9 +712,10 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
/* Only proceed if ok to */
if (ok) {
/* If file is read only, and /F supplied, delete it */
/* If file is read only, and /A:r or /F supplied, delete it */
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY &&
strstrW (quals, parmF) != NULL) {
((wanted_attrs & FILE_ATTRIBUTE_READONLY) ||
strstrW (quals, parmF) != NULL)) {
SetFileAttributesW(fpath, fd.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
}
......
......@@ -78,6 +78,22 @@ if /i not foo==FOO echo if /i seems to be broken
if /I foo==FOO echo if /I seems to work
if /I not foo==FOO echo if /I seems to be broken
echo -----------Testing del /a-----------
del /f/q *.test > nul
echo r > r.test
attrib +r r.test
echo not-r > not-r.test
if not exist not-r.test echo not-r.test not found before delete, bad
del /a:-r *.test
if not exist not-r.test echo not-r.test not found after delete, good
if not exist r.test echo r.test not found before delete, bad
if exist r.test echo r.test found before delete, good
del /a:r *.test
if not exist r.test echo r.test not found after delete, good
if exist r.test echo r.test found after delete, bad
echo -----------Testing GOTO-----------
if a==a goto dest1
:dest1
......
......@@ -78,6 +78,10 @@ Testing case sensitivity with and without /i option
if seems to default to case sensitivity
if /i seems to work
if /I seems to work
-----------Testing del /a-----------
not-r.test not found after delete, good
r.test found before delete, good
r.test not found after delete, good
-----------Testing GOTO-----------
goto with no leading space worked
goto with a leading space worked
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment