Many small edits.
This commit is contained in:
parent
741f510ce7
commit
c8b6342d3c
160 changed files with 2204 additions and 864 deletions
10
src/cmd/rm.c
10
src/cmd/rm.c
|
|
@ -1,4 +1,5 @@
|
|||
#include <u.h>
|
||||
#include <sys/stat.h>
|
||||
#include <libc.h>
|
||||
|
||||
#define rmdir p9rmdir
|
||||
|
|
@ -16,6 +17,13 @@ err(char *f)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
issymlink(char *name)
|
||||
{
|
||||
struct stat s;
|
||||
return lstat(name, &s) >= 0 && S_ISLNK(s.st_mode);
|
||||
}
|
||||
|
||||
/*
|
||||
* f is a non-empty directory. Remove its contents and then it.
|
||||
*/
|
||||
|
|
@ -48,7 +56,7 @@ rmdir(char *f)
|
|||
ndir = 0;
|
||||
for(i=0; i<n; i++){
|
||||
snprint(name, nname, "%s/%s", f, dirbuf[i].name);
|
||||
if(remove(name) != -1)
|
||||
if(remove(name) != -1 || issymlink(name))
|
||||
dirbuf[i].qid.type = QTFILE; /* so we won't recurse */
|
||||
else{
|
||||
if(dirbuf[i].qid.type & QTDIR)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue