summaryrefslogtreecommitdiff
path: root/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs.c')
-rw-r--r--fs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs.c b/fs.c
index cd60da9..5280a4d 100644
--- a/fs.c
+++ b/fs.c
@@ -262,8 +262,8 @@ iunlink(struct inode *ip)
if (ip->addrs[i] != 0) {
if (i == INDIRECT) {
inbp = bread(ip->dev, ip->addrs[INDIRECT]);
+ uint *a = (uint *) inbp->data;
for (j = 0; j < NINDIRECT; j++) {
- uint *a = (uint *) inbp->data;
if (a[j] != 0) {
bfree(ip->dev, a[j]);
a[j] = 0;
@@ -589,6 +589,9 @@ unlink(char *cp)
ip = iget(dev, inum);
+ if(ip->nlink < 1)
+ panic("unlink nlink < 1");
+
ip->nlink--;
iupdate(ip);