Ever since commit e44b0269, 64-bit mingw compilation fails with:
../../src/util/virprocess.c: In function 'virProcessGetPids':
../../src/util/virprocess.c:628:50: error: passing argument 4 of 'virStrToLong_i'
from incompatible pointer type [-Werror=incompatible-pointer-types]
if (virStrToLong_i(ent->d_name, NULL, 10, &tmp_pid) < 0)
^
In file included from ../../src/util/virprocess.c:59:0:
../../src/util/virstring.h:53:5: note: expected 'int *' but argument is of type
'pid_t * {aka long long int *}'
int virStrToLong_i(char const *s,
^
cc1: all warnings being treated as errors
Although mingw won't be using this function, it does compile the
file, and the fix is relatively simple.
* src/util/virprocess.c (virProcessGetPids): Don't assume pid_t
fits in int.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under build-breaker rule.
src/util/virprocess.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 8fa7a9b..77a038a 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -619,14 +619,16 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids)
goto cleanup;
while ((value = virDirRead(dir, &ent, taskPath)) > 0) {
+ long long tmp;
pid_t tmp_pid;
/* Skip . and .. */
if (STRPREFIX(ent->d_name, "."))
continue;
- if (virStrToLong_i(ent->d_name, NULL, 10, &tmp_pid) < 0)
+ if (virStrToLong_ll(ent->d_name, NULL, 10, &tmp) < 0)
goto cleanup;
+ tmp_pid = tmp;
if (VIR_APPEND_ELEMENT(*pids, *npids, tmp_pid) < 0)
goto cleanup;
--
2.4.3
Show replies by date