summaryrefslogtreecommitdiff
path: root/libnetfs/file-exec.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/file-exec.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/file-exec.c')
-rw-r--r--libnetfs/file-exec.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/libnetfs/file-exec.c b/libnetfs/file-exec.c
index 4f9e5034..9839c694 100644
--- a/libnetfs/file-exec.c
+++ b/libnetfs/file-exec.c
@@ -130,16 +130,25 @@ netfs_S_file_exec (struct protid *cred,
{
newpi = netfs_make_protid (netfs_make_peropen (np, O_READ, cred->po),
user);
- right = ports_get_send_right (newpi);
- err = exec_exec (_netfs_exec,
- right, MACH_MSG_TYPE_COPY_SEND,
- task, flags, argv, argvlen, envp, envplen,
- fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
- portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
- intarray, intarraylen, deallocnames, deallocnameslen,
- destroynames, destroynameslen);
- mach_port_deallocate (mach_task_self (), right);
- ports_port_deref (newpi);
+ if (newpi)
+ {
+ right = ports_get_send_right (newpi);
+ err = exec_exec (_netfs_exec,
+ right, MACH_MSG_TYPE_COPY_SEND,
+ task, flags, argv, argvlen, envp, envplen,
+ fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+ portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
+ intarray, intarraylen,
+ deallocnames, deallocnameslen,
+ destroynames, destroynameslen);
+ mach_port_deallocate (mach_task_self (), right);
+ ports_port_deref (newpi);
+ }
+ else
+ {
+ err = errno;
+ iohelp_free_iouser (user);
+ }
}
}