diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-02-04 22:22:43 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-02-04 22:22:43 +0000 |
commit | 17f756e980c7de60f478dc6eea4731536753c6da (patch) | |
tree | e54c064d642599a5902ecbbec25a6595e3e38cd3 | |
parent | a6fff908353336219511f06946581eac49d16d00 (diff) |
Formerly dir-init.c.~2~
-rw-r--r-- | libdiskfs/dir-init.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libdiskfs/dir-init.c b/libdiskfs/dir-init.c index a9e14a7d..4c1f6a44 100644 --- a/libdiskfs/dir-init.c +++ b/libdiskfs/dir-init.c @@ -26,16 +26,17 @@ diskfs_init_dir (struct node *dp, struct node *pdp) { struct dirstat *ds = alloca (diskfs_dirstat_size); struct node *foo; + error_t err; /* New links */ - if (pdp->dn_stat.st_nlink == LINK_MAX - 1) + if (pdp->dn_stat.st_nlink == diskfs_link_max - 1) return EMLINK; - np->dn_stat.st_nlink++; /* for `.' */ - np->dn_set_ctime = 1; - err = diskfs_lookup (np, ".", CREATE, &foo, dirds, cred); + dp->dn_stat.st_nlink++; /* for `.' */ + dp->dn_set_ctime = 1; + err = diskfs_lookup (dp, ".", CREATE, &foo, ds, cred); assert (err == ENOENT); - err = diskfs_direnter (np, ".", np, dirds, cred); + err = diskfs_direnter (dp, ".", dp, ds, cred); if (err) { np->dn_stat.st_nlink--; @@ -45,14 +46,15 @@ diskfs_init_dir (struct node *dp, struct node *pdp) pdp->dn_stat.st_nlink++; /* for `..' */ pdp->dn_set_ctime = 1; - err = diskfs_lookup (np, "..", CREATE, &foo, dirds, cred); + err = diskfs_lookup (np, "..", CREATE, &foo, ds, cred); assert (err == ENOENT); - err = diskfs_direnter (np, "..", dir, dirds, cred); + err = diskfs_direnter (np, "..", pdp, ds, cred); if (err) { pdp->dn_stat.st_nlink--; pdp->dn_set_ctime = 1; return err; } - diskfs_node_update (dir, 1); + diskfs_node_update (dp, 1); + return 0; } |