<<< Date Index >>>     <<< Thread Index >>>

Re: possible missing include in 1.5.13



On Wednesday, 04 October 2006 at 16:50, David Haguenauer wrote:
> Hi all,
> 
> In order to compile mutt-1.5.13 on a machine with an old compiler
> suite (based on GCC 3.3), I had to add an include directive to file
> mutt_socket.c. Otherwise, GCC would complain that struct timeval is an
> incomplete type. The error appears in the following function, where
> `tv' is declared:
> 
> int raw_socket_poll (CONNECTION* conn)
> {
>   fd_set rfds;
>   struct timeval tv = { 0, 0 };
> 
>   if (conn->fd < 0)
>     return -1;
> 
>   FD_ZERO (&rfds);
>   FD_SET (conn->fd, &rfds);
> 
>   return select (conn->fd + 1, &rfds, NULL, NULL, &tv);
> }
> 
> 
> Here's what fixed it for me:
> 
> $ diff -u mutt_socket.c{~,}
> +++ mutt_socket.c       Wed Oct  4 21:13:20 2006
> @@ -38,6 +38,7 @@
>  #include <stdlib.h>
>  #include <fcntl.h>
>  #include <sys/types.h>
> +#include <sys/time.h>
>  #include <sys/socket.h>
>  #ifdef HAVE_SYS_SELECT_H
>  #include <sys/select.h>
> 
> I tried the same patch on a more modern system (Fedora Core 4 on
> AMD64, which is based on GCC 4.0.2), and compilation went fine. So I
> assume including this patch wouldn't do any harm (assuming there is
> any interest for making Mutt compatible with antique compiler suites).

Thanks for the report. I've applied the following variant:

diff -u -p -r3.18 mutt_socket.c
--- mutt_socket.c       5 Aug 2006 00:48:16 -0000       3.18
+++ mutt_socket.c       30 Oct 2006 02:52:18 -0000
@@ -38,6 +38,9 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 #include <sys/socket.h>
 #ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>

Attachment: pgpxCtNrh0Gqc.pgp
Description: PGP signature