#include "qapi/error.h"
#include "qemu/guest-random.h"
#include "crypto/random.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
static __thread GRand *thread_rand;
}
if (i < len) {
x = g_rand_int(rand);
- __builtin_memcpy(buf + i, &x, i - len);
+ __builtin_memcpy(buf + i, &x, len - i);
}
return 0;
}
}
}
-int qemu_guest_random_seed_main(const char *optarg, Error **errp)
+int qemu_guest_random_seed_main(const char *seedstr, Error **errp)
{
- unsigned long long seed;
- if (parse_uint_full(optarg, &seed, 0)) {
- error_setg(errp, "Invalid seed number: %s", optarg);
+ uint64_t seed;
+ if (parse_uint_full(seedstr, 0, &seed)) {
+ error_setg(errp, "Invalid seed number: %s", seedstr);
return -1;
} else {
deterministic = true;