From 54e90826a931e30cb9468a8a9968155989a99f74 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Tue, 23 Aug 2022 12:34:02 +0200
Subject: file_exec: Homogeneize adding the gratuitous send right

---
 libnetfs/file-exec.c | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'libnetfs')

diff --git a/libnetfs/file-exec.c b/libnetfs/file-exec.c
index f5d25099..da49ac36 100644
--- a/libnetfs/file-exec.c
+++ b/libnetfs/file-exec.c
@@ -169,6 +169,10 @@ netfs_S_file_exec_paths (struct protid *cred,
 	  if (newpi)
 	    {
 	      right = ports_get_send_right (newpi);
+
+	      /* Add a gratuitous send right on the protid to avoid a no-sender, and thus
+		 interrupt the exec, just because we are precisely replacing the calling
+		 process!  */
 	      cred_right = ports_get_send_right (cred);
 #ifdef HAVE_EXEC_EXEC_PATHS
 	      err = exec_exec_paths (_netfs_exec,
-- 
cgit v1.2.3