From c33495ca9cf1bb12ac5bc3263458fdf3331c1f89 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 9 Sep 2001 17:32:03 +0000 Subject: 2001-08-31 Marcus Brinkmann * 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 . --- libnetfs/dir-mkfile.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'libnetfs/dir-mkfile.c') 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); } -- cgit v1.2.3