pkgsrc/mail/mutt/patches/patch-am
ben 9e9372592b Because of an Interix bug involving fork and stderr, mutt fails to exec
sendmail, which prevents mutt from sending messages.  patch-am works
around this issue by postponing the closing of all file descriptors
until after the fork.
2006-01-01 19:40:43 +00:00

41 lines
980 B
Text

$NetBSD: patch-am,v 1.1 2006/01/01 19:40:43 ben Exp $
--- sendlib.c.orig Fri May 31 09:59:39 2002
+++ sendlib.c
@@ -1803,6 +1803,7 @@ send_msg (const char *path, char **args,
*/
setsid ();
+#if !defined(__BROKEN_INTERIX_FORK)
/* next we close all open files */
#if defined(OPEN_MAX)
for (fd = 0; fd < OPEN_MAX; fd++)
@@ -1815,9 +1816,27 @@ send_msg (const char *path, char **args,
close (1);
close (2);
#endif
+#endif
/* now the second fork() */
- if ((pid = fork ()) == 0)
+ pid = fork ();
+
+#if defined(__BROKEN_INTERIX_FORK)
+ /* next we close all open files */
+#if defined(OPEN_MAX)
+ for (fd = 0; fd < OPEN_MAX; fd++)
+ close (fd);
+#elif defined(_POSIX_OPEN_MAX)
+ for (fd = 0; fd < _POSIX_OPEN_MAX; fd++)
+ close (fd);
+#else
+ close (0);
+ close (1);
+ close (2);
+#endif
+#endif
+
+ if (pid == 0)
{
/* "msg" will be opened as stdin */
if (open (msg, O_RDONLY, 0) < 0)