Article View: net.bugs
Article #79bug fix to ncheck
From: utzoodecvaxgenradbolinussmk
Date: Thu, 10 Mar 1983 12:28
Date: Thu, 10 Mar 1983 12:28
97 lines
2332 bytes
2332 bytes
The following is a bug fix to the 4.1bsd ncheck program. It
may also apply to other systems. If you use the -s option of
ncheck, it is supposed to print out special and setuid files.
However, if there are none in the file system, it instead
prints out normal directories. The fix does the right thing. There
may be a simpler bug fix, but this does the job.
*** /usr/src/cmd/ncheck.c Wed Oct 1 20:58:42 1980
--- ncheck.c Thu Mar 10 12:22:12 1983
***************
*** 38,43
daddr_t bmap();
long atol();
struct htab *lookup();
main(argc, argv)
char *argv[];
--- 38,44 -----
daddr_t bmap();
long atol();
struct htab *lookup();
+ int file_count;
main(argc, argv)
char *argv[];
***************
*** 68,73
case 's':
sflg++;
continue;
default:
--- 69,75 -----
case 's':
sflg++;
+ file_count = 0;
continue;
default:
***************
*** 143,148
return;
if ((ip->di_mode&IFMT)==IFBLK || (ip->di_mode&IFMT)==IFCHR
|| ip->di_mode&(ISUID|ISGID))
ilist[nxfile++] = ino;
return;
}
--- 145,152 -----
return;
if ((ip->di_mode&IFMT)==IFBLK || (ip->di_mode&IFMT)==IFCHR
|| ip->di_mode&(ISUID|ISGID))
+ {
+ file_count++;
ilist[nxfile++] = ino;
}
return;
***************
*** 144,149
if ((ip->di_mode&IFMT)==IFBLK || (ip->di_mode&IFMT)==IFCHR
|| ip->di_mode&(ISUID|ISGID))
ilist[nxfile++] = ino;
return;
}
lookup(ino, 1);
--- 148,154 -----
{
file_count++;
ilist[nxfile++] = ino;
+ }
return;
}
lookup(ino, 1);
***************
*** 203,209
daddr_t d;
ino_t kno;
! if((ip->di_mode&IFMT) != IFDIR)
return;
l3tol(iaddr, ip->di_addr, NADDR);
doff = 0;
--- 208,214 -----
daddr_t d;
ino_t kno;
! if(((ip->di_mode&IFMT) != IFDIR) || ((sflg == 1) && (file_count == 0)))
return;
l3tol(iaddr, ip->di_addr, NADDR);
doff = 0;
Technical Details
Message-ID:
<bnews.linus.14867>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
From: utzoo!decvax!genradbo!linus!smk Newsgroups: net.bugs,net.unix-wizards Title: bug fix to ncheck Article-I.D.: linus.14867 Posted: Thu Mar 10 12:28:45 1983 Received: Fri Mar 11 04:08:32 1983 Subject: bug fix to ncheck Date: Thu, 10 Mar 1983 12:28:45 +0000 Message-ID: <bnews.linus.14867>