提交 e4ab0848 编写于 作者: E Eric Blake

build: include correct header for time()

Found by ./autobuild.sh during a mingw cross-compile:

Commit 8a96e87e 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: NEric Blake <eblake@redhat.com>
上级 49ed6cff
/*
* 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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册