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

build: fix recent build failures

With gcc 4.5.1:

util/virpidfile.c: In function 'virPidFileAcquirePath':
util/virpidfile.c:308:66: error: nested extern declaration of '_gl_verify_function2' [-Wnested-externs]

Then in tests/commandtest.c, the new virPidFile APIs need to be used.

* src/util/virpidfile.c (virPidFileAcquirePath): Move verify to
top level.
* tests/commandtest.c: Use new pid APIs.
上级 c8a3a265
...@@ -299,13 +299,13 @@ cleanup: ...@@ -299,13 +299,13 @@ cleanup:
} }
verify(sizeof(pid_t) <= sizeof(unsigned int));
int virPidFileAcquirePath(const char *path, int virPidFileAcquirePath(const char *path,
pid_t pid) pid_t pid)
{ {
int fd = -1; int fd = -1;
char pidstr[INT_BUFSIZE_BOUND(pid)]; char pidstr[INT_BUFSIZE_BOUND(pid)];
verify(sizeof(pid_t) <= sizeof(unsigned int));
if (path[0] == '\0') if (path[0] == '\0')
return 0; return 0;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "memory.h" #include "memory.h"
#include "command.h" #include "command.h"
#include "virfile.h" #include "virfile.h"
#include "virpidfile.h"
#ifdef WIN32 #ifdef WIN32
...@@ -214,7 +215,7 @@ cleanup: ...@@ -214,7 +215,7 @@ cleanup:
static int test4(const void *unused ATTRIBUTE_UNUSED) static int test4(const void *unused ATTRIBUTE_UNUSED)
{ {
virCommandPtr cmd = virCommandNew(abs_builddir "/commandhelper"); virCommandPtr cmd = virCommandNew(abs_builddir "/commandhelper");
char *pidfile = virFilePid(abs_builddir, "commandhelper"); char *pidfile = virPidFileBuildPath(abs_builddir, "commandhelper");
pid_t pid; pid_t pid;
int ret = -1; int ret = -1;
...@@ -230,7 +231,7 @@ static int test4(const void *unused ATTRIBUTE_UNUSED) ...@@ -230,7 +231,7 @@ static int test4(const void *unused ATTRIBUTE_UNUSED)
goto cleanup; goto cleanup;
} }
if (virFileReadPid(abs_builddir, "commandhelper", &pid) < 0) { if (virPidFileRead(abs_builddir, "commandhelper", &pid) < 0) {
printf("cannot read pidfile\n"); printf("cannot read pidfile\n");
goto cleanup; goto cleanup;
} }
...@@ -668,7 +669,7 @@ cleanup: ...@@ -668,7 +669,7 @@ cleanup:
static int test18(const void *unused ATTRIBUTE_UNUSED) static int test18(const void *unused ATTRIBUTE_UNUSED)
{ {
virCommandPtr cmd = virCommandNewArgList("sleep", "100", NULL); virCommandPtr cmd = virCommandNewArgList("sleep", "100", NULL);
char *pidfile = virFilePid(abs_builddir, "commandhelper"); char *pidfile = virPidFileBuildPath(abs_builddir, "commandhelper");
pid_t pid; pid_t pid;
int ret = -1; int ret = -1;
...@@ -686,7 +687,7 @@ static int test18(const void *unused ATTRIBUTE_UNUSED) ...@@ -686,7 +687,7 @@ static int test18(const void *unused ATTRIBUTE_UNUSED)
} }
alarm(0); alarm(0);
if (virFileReadPid(abs_builddir, "commandhelper", &pid) < 0) { if (virPidFileRead(abs_builddir, "commandhelper", &pid) < 0) {
printf("cannot read pidfile\n"); printf("cannot read pidfile\n");
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册