[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 1/2] libxl: fix _SC_GETPW_R_SIZE_MAX usage



On Thu, 2016-01-14 at 16:06 +0100, Roger Pau Monne wrote:
> If sysconf(_SC_GETPW_R_SIZE_MAX) fails for any reason just use an initial
> buffer size of 2048. This is not a critical failure, and the code that
> makes use of this buffer is able to expand it later if required.
> 
> Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
> ---
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

Well done on your prescience on fixing all my comments on v1 before you'd
even seen them!

Applied.

> ---
> Changes since v1:
> Â- Use a default buffer size if sysconf(_SC_GETPW_R_SIZE_MAX) fails for
> any
> ÂÂÂreason, this should not be a critical failure.
> ---
> Âtools/libxl/libxl_dm.c | 7 ++++---
> Â1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index 0aaefd9..a088d71 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -730,9 +730,10 @@ static int libxl__dm_runas_helper(libxl__gc *gc,
> const char *username)
> Â
> ÂÂÂÂÂbuf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
> ÂÂÂÂÂif (buf_size < 0) {
> -ÂÂÂÂÂÂÂÂLOGE(ERROR, "sysconf(_SC_GETPW_R_SIZE_MAX) returned error %ld",
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbuf_size);
> -ÂÂÂÂÂÂÂÂreturn ERROR_FAIL;
> +ÂÂÂÂÂÂÂÂbuf_size = 2048;
> +ÂÂÂÂÂÂÂÂLOG(DEBUG,
> +"sysconf(_SC_GETPW_R_SIZE_MAX) failed, setting the initial buffer size
> to %ld",
> +ÂÂÂÂÂÂÂÂÂÂÂÂbuf_size);
> ÂÂÂÂÂ}
> Â
> ÂÂÂÂÂwhile (1) {

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.