#define DEFINE_USERLOOKUP_HELPER(NAME,SPEC_TYPE,STRUCTNAME,SYSCONF) \
static int userlookup_helper_##NAME(libxl__gc *gc, \
SPEC_TYPE spec, \
- struct STRUCTNAME **out) \
+ struct STRUCTNAME *resultbuf, \
+ struct STRUCTNAME **out) \
{ \
- struct STRUCTNAME resultbuf, *resultp = NULL; \
+ struct STRUCTNAME *resultp = NULL; \
char *buf = NULL; \
long buf_size; \
int ret; \
\
while (1) { \
buf = libxl__realloc(gc, buf, buf_size); \
- ret = NAME##_r(spec, &resultbuf, buf, buf_size, &resultp); \
+ ret = NAME##_r(spec, resultbuf, buf, buf_size, &resultp); \
if (ret == ERANGE) { \
buf_size += 128; \
continue; \
uint64_t ram_size;
const char *path, *chardev;
char *user = NULL;
- struct passwd *user_base;
+ struct passwd *user_base, user_pwbuf;
dm_args = flexarray_make(gc, 16, 1);
dm_envs = flexarray_make(gc, 16, 1);
}
user = GCSPRINTF("%s%d", LIBXL_QEMU_USER_BASE, guest_domid);
- ret = userlookup_helper_getpwnam(gc, user, 0);
+ ret = userlookup_helper_getpwnam(gc, user, &user_pwbuf, 0);
if (ret < 0)
return ret;
if (ret > 0)
goto end_search;
ret = userlookup_helper_getpwnam(gc, LIBXL_QEMU_USER_RANGE_BASE,
- &user_base);
+ &user_pwbuf, &user_base);
if (ret < 0)
return ret;
if (ret > 0) {
- struct passwd *user_clash;
+ struct passwd *user_clash, user_clash_pwbuf;
uid_t intended_uid = user_base->pw_uid + guest_domid;
- ret = userlookup_helper_getpwuid(gc, intended_uid, &user_clash);
+ ret = userlookup_helper_getpwuid(gc, intended_uid,
+ &user_clash_pwbuf, &user_clash);
if (ret < 0)
return ret;
if (ret > 0) {
}
user = LIBXL_QEMU_USER_SHARED;
- ret = userlookup_helper_getpwnam(gc, user, 0);
+ ret = userlookup_helper_getpwnam(gc, user, &user_pwbuf, 0);
if (ret < 0)
return ret;
if (ret > 0) {