|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 20/22] libxl: userlookup_helper_getpwnam rename and turn into a macro
On Fri, Sep 15, 2017 at 07:48:57PM +0100, Ian Jackson wrote:
> +/*
> + * userlookup_helper_getpwnam(libxl__gc*, const char *user,
> + * struct passwd **pwd_r);
> + *
> + * returns 1 if the user was found, 0 if it was not, -1 on error
> + */
> +#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, *resultp = NULL; \
> + char *buf = NULL; \
> + long buf_size; \
> + int ret; \
> + \
> + buf_size = sysconf(SYSCONF); \
> + if (buf_size < 0) { \
> + buf_size = 2048; \
> + LOG(DEBUG, \
> + "sysconf failed, setting the initial buffer size to %ld", \
> + buf_size); \
> + } \
> + \
> + while (1) { \
> + buf = libxl__realloc(gc, buf, buf_size); \
> + ret = NAME##_r(spec, &resultbuf, buf, buf_size, &resultp); \
> + if (ret == ERANGE) { \
> + buf_size += 128; \
> + continue; \
> + } \
> + if (ret != 0) \
> + return ERROR_FAIL; \
> + if (resultp != NULL) { \
> + if (out) *out = resultp; \
> + return 1; \
> + } \
> + return 0; \
> + } \
> + }
> +
Some of the "\"'s are misaligned.
With or without aligning them:
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |