summaryrefslogtreecommitdiff
path: root/libnetfs/dir-mkfile.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2001-09-09 17:32:03 +0000
committerMarcus Brinkmann <marcus@gnu.org>2001-09-09 17:32:03 +0000
commitc33495ca9cf1bb12ac5bc3263458fdf3331c1f89 (patch)
treef5575875f366c78f59c4d59f5ea24c80e77a5cc0 /libnetfs/dir-mkfile.c
parentcd07eece45992a52e4c6c9ad1d7ae47b0f82fbe9 (diff)
2001-08-31 Marcus Brinkmann <marcus@gnu.org>
* file-get-translator.c (netfs_S_file_get_translator): If asprintf() fails, set ERR to errno. * dir-lookup.c (netfs_S_dir_lookup): Catch if asprintf() fails and return ENOMEM. If netfs_make_protid() fails, set ERROR to errno, not ENOMEM. Do this before freeing USER. * dir-mkfile.c (netfs_S_dir_mkfile): If netfs_make_protid() fails, set ERROR to errno and free USER. * file-exec.c (netfs_S_file_exec): Likewise. Reported by Igor Khavkine <i_khavki@alcor.concordia.ca>.
Diffstat (limited to 'libnetfs/dir-mkfile.c')
-rw-r--r--libnetfs/dir-mkfile.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libnetfs/dir-mkfile.c b/libnetfs/dir-mkfile.c
index 16c5dd77..7d388737 100644
--- a/libnetfs/dir-mkfile.c
+++ b/libnetfs/dir-mkfile.c
@@ -44,9 +44,17 @@ netfs_S_dir_mkfile (struct protid *diruser, int flags, mode_t mode,
newpi = netfs_make_protid (netfs_make_peropen (np, flags,
diruser->po),
user);
- *newfile = ports_get_right (newpi);
- *newfiletype = MACH_MSG_TYPE_MAKE_SEND;
- ports_port_deref (newpi);
+ if (newpi)
+ {
+ *newfile = ports_get_right (newpi);
+ *newfiletype = MACH_MSG_TYPE_MAKE_SEND;
+ ports_port_deref (newpi);
+ }
+ else
+ {
+ err = errno;
+ iohelp_free_iouser (user);
+ }
}
netfs_nput (np);
}