[PATCH wayland] scanner: set errno=0 before strtol
Kristian Høgsberg
hoegsberg at gmail.com
Tue Dec 17 10:58:42 PST 2013
On Tue, Dec 17, 2013 at 01:48:54PM +0200, Adrian Negreanu wrote:
> From: Adrian Negreanu <adrian.m.negreanu at intel.com>
>
> POSIX says to set errno=0 before calling strtol since
> the return value alne cannot tell a failure.
Right, looks good, thanks. Committed.
Kristian
> on ubuntu armel I get:
>
> ../src/wayland-scanner client-header < ../../protocol/wayland.xml > wayland-client-protocol.h
> <stdin>:1188: error: invalid integer (2)
>
> Signed-off-by: Adrian Negreanu <adrian.m.negreanu at intel.com>
> ---
> src/scanner.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/scanner.c b/src/scanner.c
> index a030181..243ddfd 100644
> --- a/src/scanner.c
> +++ b/src/scanner.c
> @@ -399,6 +399,7 @@ start_element(void *data, const char *element_name, const char **atts)
> message->destructor = 0;
>
> if (since != NULL) {
> + errno = 0;
> version = strtol(since, &end, 0);
> if (errno == EINVAL || end == since || *end != '\0')
> fail(&ctx->loc,
> --
> 1.8.0
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list