Clean buffy.c and init.c
[apps/madmutt.git] / sendlib.c
index ef2b9da..b024afc 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
 #include <lib-mime/mime.h>
 #include <lib-ui/curses.h>
 
+#include <lib-crypt/crypt.h>
+
+#include "lib/list.h"
+
 #include "mutt.h"
 #include "handler.h"
 #include "recvattach.h"
@@ -26,7 +30,6 @@
 #include "copy.h"
 #include "pager.h"
 #include "charset.h"
-#include <lib-crypt/crypt.h>
 #include "mutt_idna.h"
 
 #ifdef USE_LIBESMTP
@@ -1669,7 +1672,7 @@ static void mutt_gen_localpart(char *buf, unsigned int len, const char *fmt)
 #undef APPEND_FMT
 }
 
-char *mutt_gen_msgid (void)
+static char *mutt_gen_msgid (void)
 {
   char buf[SHORT_STRING];
   char localpart[SHORT_STRING];
@@ -1732,17 +1735,8 @@ send_msg(const char *path, const char **args, const char *msg, char **tempfile)
     setsid ();
 
     /* next we close all open files */
-#if defined(OPEN_MAX)
-    for (fd = 0; fd < OPEN_MAX; fd++)
+    for (fd = 0; fd < getdtablesize(); 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
 
     /* now the second fork() */
     if ((pid = fork ()) == 0) {