]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: include correct header for time()
authorEric Blake <eblake@redhat.com>
Tue, 14 Apr 2015 19:15:06 +0000 (13:15 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 14 Apr 2015 19:24:51 +0000 (13:24 -0600)
Found by ./autobuild.sh during a mingw cross-compile:

Commit 8a96e87 was not innocuous - glibc happens to leak the
definition of time() through other headers, so that even without
<sys/select.h>, virrandom.c compiled just fine.  But on mingw,
we were not so lucky; <sys/select.h> was important for its side
effect of dragging in <time.h>, and we now have nothing providing
the declaration of time():

../../src/util/virrandom.c: In function 'virRandomOnceInit':
../../src/util/virrandom.c:65:5: error: implicit declaration of function 'time' [-Werror=implicit-function-declaration]
     unsigned int seed = time(NULL) ^ getpid();
          ^
  ../../src/util/virrandom.c:65:5: error: nested extern declaration of 'time' [-Werror=nested-externs]

Signed-off-by: Eric Blake <eblake@redhat.com>
src/util/virrandom.c

index 4301f3f3d6fc4eb0c7dd64fa1d1faf24da07673c..67a8bd05544046ad3af28a5f8cdc79062465d587 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2014 Red Hat, Inc.
+ * Copyright (C) 2012-2015 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,6 +25,7 @@
 #include <inttypes.h>
 #include <math.h>
 #include <strings.h>
+#include <time.h>
 
 #include "virrandom.h"
 #include "virthread.h"