2012-02-24 17:18:09

by Mike Frysinger

[permalink] [raw]
Subject: [PATCH] libext2fs: include sys/time.h for gettimeofday()

Building on my glibc-2.15 system hits a warning:
gen_bitmap64.c: In function 'ext2fs_alloc_generic_bmap':
gen_bitmap64.c:127:2: warning: implicit declaration of function
'gettimeofday' [-Wimplicit-function-declaration]

Include sys/time.h if it's available for the prototype.

Signed-off-by: Mike Frysinger <[email protected]>
---
lib/ext2fs/gen_bitmap64.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
index bf1a76b..fa8d7b7 100644
--- a/lib/ext2fs/gen_bitmap64.c
+++ b/lib/ext2fs/gen_bitmap64.c
@@ -25,6 +25,9 @@
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif

#include "ext2_fs.h"
#include "ext2fsP.h"
--
1.7.8.4



2012-02-24 17:18:09

by Mike Frysinger

[permalink] [raw]
Subject: [PATCH] libext2fs: include config.h for HAVE_xxx defines

We check HAVE_UNISTD_H but haven't included config.h yet, so we end up
hitting warnings about missing prototypes for close/read/etc... funcs.

Signed-off-by: Mike Frysinger <[email protected]>
---
lib/ext2fs/mmp.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/ext2fs/mmp.c b/lib/ext2fs/mmp.c
index b27d9a4..49a11da 100644
--- a/lib/ext2fs/mmp.c
+++ b/lib/ext2fs/mmp.c
@@ -13,6 +13,8 @@
#define _GNU_SOURCE
#endif

+#include "config.h"
+
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
--
1.7.8.4


2012-02-27 06:13:33

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] libext2fs: include sys/time.h for gettimeofday()

On Fri, Feb 24, 2012 at 12:18:07PM -0500, Mike Frysinger wrote:
> Building on my glibc-2.15 system hits a warning:
> gen_bitmap64.c: In function 'ext2fs_alloc_generic_bmap':
> gen_bitmap64.c:127:2: warning: implicit declaration of function
> 'gettimeofday' [-Wimplicit-function-declaration]
>
> Include sys/time.h if it's available for the prototype.
>
> Signed-off-by: Mike Frysinger <[email protected]>

Thanks, applied.

- Ted

2012-02-27 06:13:57

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] libext2fs: include config.h for HAVE_xxx defines

On Fri, Feb 24, 2012 at 12:18:08PM -0500, Mike Frysinger wrote:
> We check HAVE_UNISTD_H but haven't included config.h yet, so we end up
> hitting warnings about missing prototypes for close/read/etc... funcs.
>
> Signed-off-by: Mike Frysinger <[email protected]>

Thanks, applied.

- Ted