summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-06-21 17:25:12 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-06-21 17:25:12 +0000
commit3803000fca4462969cf6b0610f16c78232062426 (patch)
tree20f3c200cc59884d8e9b0229deff3b8e73a2a4ef /libdiskfs
parent470b4a107790b8ad770a7c3fd2e9d133088f9fb9 (diff)
Formerly dir-chg.c.~4~
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/dir-chg.c15
1 files changed, 11 insertions, 4 deletions
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;
}