Skip to content
Snippets Groups Projects
Commit 5e03dd86 authored by rsc's avatar rsc
Browse files

add test for rm .

parent 15b326b6
No related branches found
No related tags found
No related merge requests found
......@@ -31,9 +31,6 @@ sysfile.c:
general:
sizeof parens?
usertests.c:
check for rm of . or ..
L=$HOME/mit/l
(for i in *.c; do xoc -x xgnu -x ./nodecleq.zeta --typesonly $i; done) 2>&1 | grep warning
......@@ -984,6 +984,7 @@ fourteen(void)
{
int fd;
// DIRSIZ is 14.
printf(1, "fourteen test\n");
if(mkdir("12345678901234") != 0){
......@@ -1019,6 +1020,45 @@ fourteen(void)
printf(1, "fourteen ok\n");
}
void
rmdot(void)
{
printf(1, "rmdot test\n");
if(mkdir("dots") != 0){
printf(1, "mkdir dots failed\n");
exit();
}
if(chdir("dots") != 0){
printf(1, "chdir dots failed\n");
exit();
}
if(unlink(".") == 0){
printf(1, "rm . worked!\n");
exit();
}
if(unlink("..") == 0){
printf(1, "rm .. worked!\n");
exit();
}
if(chdir("/") != 0){
printf(1, "chdir / failed\n");
exit();
}
if(unlink("dots/.") == 0){
printf(1, "unlink dots/. worked!\n");
exit();
}
if(unlink("dots/..") == 0){
printf(1, "unlink dots/.. worked!\n");
exit();
}
if(unlink("dots") != 0){
printf(1, "unlink dots failed!\n");
exit();
}
printf(1, "rmdot ok\n");
}
int
main(int argc, char *argv[])
{
......@@ -1040,6 +1080,7 @@ main(int argc, char *argv[])
preempt();
exitwait();
rmdot();
fourteen();
bigfile();
subdir();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment