From 3803000fca4462969cf6b0610f16c78232062426 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Tue, 21 Jun 1994 17:25:12 +0000 Subject: Formerly dir-chg.c.~4~ --- libdiskfs/dir-chg.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'libdiskfs/dir-chg.c') diff --git a/libdiskfs/dir-chg.c b/libdiskfs/dir-chg.c index bc13846e..4c79fa27 100644 --- a/libdiskfs/dir-chg.c +++ b/libdiskfs/dir-chg.c @@ -24,17 +24,24 @@ diskfs_S_dir_notice_changes (struct protid *cred, mach_port_t notify) { struct dirmod *req; + struct node *np; if (!cred) return EOPNOTSUPP; + np = cred->po->np; req = malloc (sizeof (struct dirmod)); - mutex_lock (&cred->po->np->lock); + mutex_lock (&np->lock); + if (!S_ISDIR (np->dn_stat.st_mode)) + { + mutex_unlock (&np->lock); + return ENOTDIR; + } req->port = notify; - req->next = cred->po->np->dirmod_reqs; - cred->po->np->dirmod_reqs = req; + req->next = np->dirmod_reqs; + np->dirmod_reqs = req; nowait_dir_changed (notify, DIR_CHANGED_NULL, ""); - mutex_unlock (&cred->po->np->lock); + mutex_unlock (&np->lock); return 0; } -- cgit v1.2.3