1 From c22e90365d89346258394833cbcad03ff32b2e27 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Fri, 29 May 2015 20:56:00 -0700
4 Subject: [PATCH weston] make error() portable
6 error() is not posix but gnu extension so may not be available on all
7 kind of systemsi e.g. musl.
9 Signed-off-by: Khem Raj <raj.khem@gmail.com>
11 Upstream-Status: Submitted
14 src/weston-error.h | 20 ++++++++++++++++++++
15 src/weston-launch.c | 2 +-
16 3 files changed, 23 insertions(+), 1 deletion(-)
17 create mode 100644 src/weston-error.h
19 diff --git a/configure.ac b/configure.ac
20 index 263fc22..f52cd62 100644
23 @@ -57,6 +57,8 @@ AC_CHECK_DECL(CLOCK_MONOTONIC,[],
24 [[#include <time.h>]])
25 AC_CHECK_HEADERS([execinfo.h])
27 +AC_CHECK_HEADERS([error.h])
29 AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
31 COMPOSITOR_MODULES="wayland-server >= 1.7.93 pixman-1 >= 0.25.2"
32 diff --git a/src/weston-error.h b/src/weston-error.h
34 index 0000000..2089d02
36 +++ b/src/weston-error.h
38 +#ifndef _WESTON_ERROR_H
39 +#define _WESTON_ERROR_H
41 +#if defined(HAVE_ERROR_H)
46 +#define _weston_error(S, E, F, ...) do { \
48 + err(S, F ": %s", ##__VA_ARGS__, strerror(E)); \
50 + err(S, F, ##__VA_ARGS__); \
53 +#define error _weston_error
58 diff --git a/src/weston-launch.c b/src/weston-launch.c
59 index 10c66de..3e6d30a 100644
60 --- a/src/weston-launch.c
61 +++ b/src/weston-launch.c
69 #include <sys/types.h>
73 #include "weston-launch.h"
74 +#include "weston-error.h"