[nas] [PATCH] Fix warnings about 'free' in nasd on GNU/Linux x86
Jon Trulson
jon at radscan.com
Fri Aug 16 13:22:27 MDT 2013
On Fri, 16 Aug 2013, Erik Auerswald wrote:
> Hi,
>
> the attached patch fixes the following warnings about 'free' when
> compiling NAS on GNU/Linux x86 (32 bit):
>
> ---8<---
> uevents.c: In function ‘ProcessAudioEvents’:
> auevents.c:149: warning: incompatible implicit declaration of built-in function ‘free’
> auevents.c: In function ‘AuDequeueEvents’:
> auevents.c:249: warning: incompatible implicit declaration of built-in function ‘free’
> connection.c: In function ‘open_unix_socket’:
> connection.c:585: warning: incompatible implicit declaration of built-in function ‘free’
> connection.c:608: warning: incompatible implicit declaration of built-in function ‘free’
> ---8<---
>
> Please review and test the changes. Testing on different operating systems
> and/or different architectures would be nice.
>
> I intend to apply the patch over the weekend unless somebody objects. :-)
>
I object your honor! :)
This is rather strange. Including stdlib.h should be the correct fix.
I did this, and it seems to work, but saw two other warnings that are
worrisome:
=-=-=-=-
connection.c: In function ‘AuthAudit’:
connection.c:1328:27: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat]
connection.c:1328:27: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat]
=-=-=-=-
This is basically inet_ntoa() returning an int, rather than the string
it should be returning. This is coredump material on x86_64, so
clearly this function (in addition to free()) is not being prototyped
properly either.
Attached is my suggested patch that should resolve both issues on
linux at least. Could you try it on your 32b machine?
--
Jon Trulson
"I was not genomed to alter reality."
- Sonmi 451
-------------- next part --------------
Index: server/os/connection.c
===================================================================
--- server/os/connection.c (revision 289)
+++ server/os/connection.c (working copy)
@@ -68,7 +68,10 @@
#if defined(__CYGWIN__)
#define S_IFSOCK _IFSOCK
#define S_IFMT _IFMT
+#endif /* __CYGWIN__ */
+#if defined(__CYGWIN__) || defined(linux)
+#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <sys/types.h>
@@ -77,7 +80,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
-#endif
+#endif /* defined(__CYGWIN__) || defined(linux) */
More information about the nas
mailing list