avoid unix special files

This commit is contained in:
rsc 2005-02-08 20:27:10 +00:00
parent 8a75090664
commit 5fc55a953e

View file

@ -382,18 +382,6 @@ isexcluded(char *name)
return 0; return 0;
} }
static int
islink(char *name)
{
struct stat st;
if(lstat(name, &st) < 0)
return 0;
if((st.st_mode&S_IFMT) == S_IFLNK)
return 1;
return 0;
}
static void static void
vacfile(DirSink *dsink, char *lname, char *sname, VacFile *vf) vacfile(DirSink *dsink, char *lname, char *sname, VacFile *vf)
{ {
@ -410,9 +398,14 @@ vacfile(DirSink *dsink, char *lname, char *sname, VacFile *vf)
if(merge && vacmerge(dsink, lname, sname) >= 0) if(merge && vacmerge(dsink, lname, sname) >= 0)
return; return;
if(islink(sname)) if((dir = dirstat(sname)) == nil){
warn("could not stat file %s: %r", lname);
if(dir->mode&(DMSYMLINK|DMDEVICE|DMNAMEDPIPE|DMSOCKET)){
free(dir);
return; return;
}
free(dir);
fd = open(sname, OREAD); fd = open(sname, OREAD);
if(fd < 0) { if(fd < 0) {
warn("could not open file: %s: %r", lname); warn("could not open file: %s: %r", lname);