From: Ian Campbell <ian.campbell@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>, xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH v2 1/2] libxl: fix _SC_GETPW_R_SIZE_MAX usage
Date: Fri, 15 Jan 2016 10:56:41 +0000 [thread overview]
Message-ID: <1452855401.32341.67.camel@citrix.com> (raw)
In-Reply-To: <1452784011-73931-2-git-send-email-roger.pau@citrix.com>
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@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
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@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-01-15 10:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 15:06 [PATCH 0/2] libxl: FreeBSD related fixes Roger Pau Monne
2016-01-14 15:06 ` [PATCH v2 1/2] libxl: fix _SC_GETPW_R_SIZE_MAX usage Roger Pau Monne
2016-01-15 2:55 ` Doug Goldstein
2016-01-15 10:56 ` Ian Campbell [this message]
2016-01-14 15:06 ` [PATCH v2 2/2] libxl: fix UUID usage on FreeBSD Roger Pau Monne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452855401.32341.67.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.