log: remove "%m" from format strings by using strerror(errno)

The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.

In Weston code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.

Remove all the occurrences of the specifier "%m" in Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
dev
Antonio Borneo 6 years ago
parent 45d38856c8
commit 3957863667
  1. 4
      clients/calibrator.c
  2. 4
      clients/clickdot.c
  3. 4
      clients/cliptest.c
  4. 4
      clients/confine.c
  5. 8
      clients/desktop-shell.c
  6. 4
      clients/dnd.c
  7. 8
      clients/editor.c
  8. 8
      clients/eventdemo.c
  9. 4
      clients/flower.c
  10. 4
      clients/fullscreen.c
  11. 4
      clients/gears.c
  12. 4
      clients/image.c
  13. 10
      clients/ivi-shell-user-interface.c
  14. 4
      clients/keyboard.c
  15. 4
      clients/multi-resource.c
  16. 18
      clients/nested.c
  17. 9
      clients/presentation-shm.c
  18. 4
      clients/resizor.c
  19. 4
      clients/scaler.c
  20. 9
      clients/screenshot.c
  21. 7
      clients/simple-damage.c
  22. 6
      clients/simple-im.c
  23. 7
      clients/simple-shm.c
  24. 7
      clients/simple-touch.c
  25. 4
      clients/smoke.c
  26. 4
      clients/stacking.c
  27. 4
      clients/subsurfaces.c
  28. 8
      clients/terminal.c
  29. 4
      clients/transformed.c
  30. 10
      clients/weston-debug.c
  31. 3
      clients/weston-info.c
  32. 20
      clients/window.c
  33. 24
      compositor/main.c
  34. 27
      compositor/screen-share.c
  35. 7
      compositor/xwayland.c
  36. 44
      libweston/compositor-drm.c
  37. 15
      libweston/compositor-wayland.c
  38. 5
      libweston/compositor.c
  39. 6
      libweston/input.c
  40. 24
      libweston/launcher-direct.c
  41. 2
      libweston/launcher-logind.c
  42. 6
      libweston/launcher-weston-launch.c
  43. 4
      libweston/screenshooter.c
  44. 16
      libweston/weston-launch.c
  45. 8
      tests/ivi-layout-test-plugin.c
  46. 2
      tests/weston-test-runner.c
  47. 4
      tests/weston-test.c
  48. 6
      xwayland/launcher.c
  49. 8
      xwayland/selection.c

@ -32,6 +32,7 @@
#include <math.h>
#include <assert.h>
#include <getopt.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
@ -290,7 +291,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -34,6 +34,7 @@
#include <assert.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
@ -328,7 +329,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -45,6 +45,7 @@
#include <cairo.h>
#include <float.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
@ -621,7 +622,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -34,6 +34,7 @@
#include <math.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
@ -490,7 +491,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -212,7 +212,7 @@ panel_launcher_activate(struct panel_launcher *widget)
pid = fork();
if (pid < 0) {
fprintf(stderr, "fork failed: %m\n");
fprintf(stderr, "fork failed: %s\n", strerror(errno));
return;
}
@ -225,7 +225,8 @@ panel_launcher_activate(struct panel_launcher *widget)
exit(EXIT_FAILURE);
if (execve(argv[0], argv, widget->envp.data) < 0) {
fprintf(stderr, "execl '%s' failed: %m\n", argv[0]);
fprintf(stderr, "execl '%s' failed: %s\n", argv[0],
strerror(errno));
exit(1);
}
}
@ -1519,7 +1520,8 @@ int main(int argc, char *argv[])
desktop.display = display_create(&argc, argv);
if (desktop.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -35,6 +35,7 @@
#include <cairo.h>
#include <sys/epoll.h>
#include <stdbool.h>
#include <errno.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
@ -848,7 +849,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -580,7 +580,7 @@ data_source_send(void *data,
struct editor *editor = data;
if (write(fd, editor->selected_text, strlen(editor->selected_text) + 1) < 0)
fprintf(stderr, "write failed: %m\n");
fprintf(stderr, "write failed: %s\n", strerror(errno));
close(fd);
}
@ -1609,7 +1609,8 @@ main(int argc, char *argv[])
text_buffer = read_file(argv[1]);
if (text_buffer == NULL) {
fprintf(stderr, "could not read file '%s': %m\n", argv[1]);
fprintf(stderr, "could not read file '%s': %s\n",
argv[1], strerror(errno));
return -1;
}
}
@ -1618,7 +1619,8 @@ main(int argc, char *argv[])
editor.display = display_create(&argc, argv);
if (editor.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
free(text_buffer);
return -1;
}

@ -37,6 +37,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <cairo.h>
@ -515,14 +517,16 @@ main(int argc, char *argv[])
/* Connect to the display and have the arguments parsed */
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
/* Create new eventdemo window */
e = eventdemo_create(d);
if (e == NULL) {
fprintf(stderr, "failed to create eventdemo: %m\n");
fprintf(stderr, "failed to create eventdemo: %s\n",
strerror(errno));
return -1;
}

@ -30,6 +30,7 @@
#include <time.h>
#include <math.h>
#include <cairo.h>
#include <errno.h>
#include <sys/time.h>
#include <linux/input.h>
@ -172,7 +173,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -30,6 +30,7 @@
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <cairo.h>
#include <linux/input.h>
@ -518,7 +519,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -30,6 +30,7 @@
#include <string.h>
#include <math.h>
#include <time.h>
#include <errno.h>
#include <GL/gl.h>
#include <EGL/egl.h>
@ -488,7 +489,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
gears = gears_create(d);

@ -36,6 +36,7 @@
#include <time.h>
#include <cairo.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
@ -419,7 +420,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -35,6 +35,7 @@
#include <signal.h>
#include <sys/mman.h>
#include <getopt.h>
#include <errno.h>
#include <wayland-cursor.h>
#include <wayland-client-protocol.h>
#include "shared/cairo-util.h"
@ -806,8 +807,8 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return ;
}
@ -815,7 +816,7 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (MAP_FAILED == p_wlCtx->data) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return;
}
@ -828,7 +829,8 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
WL_SHM_FORMAT_ARGB8888);
if (NULL == p_wlCtx->wlBuffer) {
fprintf(stderr, "wl_shm_create_buffer failed: %m\n");
fprintf(stderr, "wl_shm_create_buffer failed: %s\n",
strerror(errno));
close(fd);
return;
}

@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <linux/input.h>
#include <cairo.h>
@ -1019,7 +1020,8 @@ main(int argc, char *argv[])
virtual_keyboard.display = display_create(&argc, argv);
if (virtual_keyboard.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -97,8 +97,8 @@ attach_buffer(struct window *window, int width, int height)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}

@ -34,6 +34,7 @@
#include <sys/epoll.h>
#include <sys/socket.h>
#include <unistd.h>
#include <errno.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@ -330,8 +331,8 @@ launch_client(struct nested *nested, const char *path)
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
fprintf(stderr, "launch_client: "
"socketpair failed while launching '%s': %m\n",
path);
"socketpair failed while launching '%s': %s\n",
path, strerror(errno));
free(client);
return NULL;
}
@ -342,7 +343,8 @@ launch_client(struct nested *nested, const char *path)
close(sv[1]);
free(client);
fprintf(stderr, "launch_client: "
"fork failed while launching '%s': %m\n", path);
"fork failed while launching '%s': %s\n", path,
strerror(errno));
return NULL;
}
@ -354,7 +356,8 @@ launch_client(struct nested *nested, const char *path)
* get a non-CLOEXEC fd to pass through exec. */
clientfd = dup(sv[1]);
if (clientfd == -1) {
fprintf(stderr, "compositor: dup failed: %m\n");
fprintf(stderr, "compositor: dup failed: %s\n",
strerror(errno));
exit(-1);
}
@ -363,8 +366,8 @@ launch_client(struct nested *nested, const char *path)
execl(path, path, NULL);
fprintf(stderr, "compositor: executing '%s' failed: %m\n",
path);
fprintf(stderr, "compositor: executing '%s' failed: %s\n",
path, strerror(errno));
exit(-1);
}
@ -1116,7 +1119,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -35,6 +35,7 @@
#include <sys/mman.h>
#include <signal.h>
#include <time.h>
#include <errno.h>
#include <wayland-client.h>
#include "shared/helpers.h"
@ -141,14 +142,14 @@ create_shm_buffers(struct display *display, struct buffer **buffers,
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return -1;
}
@ -480,7 +481,7 @@ window_emulate_rendering(struct window *window)
ret = nanosleep(&delay, NULL);
if (ret)
printf("nanosleep failed: %m\n");
printf("nanosleep failed: %s\n", strerror(errno));
}
static void

@ -31,6 +31,7 @@
#include <cairo.h>
#include <math.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
@ -439,7 +440,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <cairo.h>
#include <linux/input.h>
@ -288,7 +289,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -173,14 +173,14 @@ screenshot_create_shm_buffer(int width, int height, void **data_out,
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return NULL;
}
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return NULL;
}
@ -286,7 +286,8 @@ int main(int argc, char *argv[])
display = wl_display_connect(NULL);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -35,6 +35,7 @@
#include <sys/mman.h>
#include <sys/time.h>
#include <signal.h>
#include <errno.h>
#include <wayland-client.h>
#include "shared/os-compatibility.h"
@ -123,14 +124,14 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return -1;
}

@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <linux/input.h>
@ -490,7 +491,8 @@ main(int argc, char *argv[])
simple_im.display = wl_display_connect(NULL);
if (simple_im.display == NULL) {
fprintf(stderr, "Failed to connect to server: %m\n");
fprintf(stderr, "Failed to connect to server: %s\n",
strerror(errno));
return -1;
}
@ -516,7 +518,7 @@ main(int argc, char *argv[])
ret = wl_display_dispatch(simple_im.display);
if (ret == -1) {
fprintf(stderr, "Dispatch error: %m\n");
fprintf(stderr, "Dispatch error: %s\n", strerror(errno));
return -1;
}

@ -33,6 +33,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <signal.h>
#include <errno.h>
#include <wayland-client.h>
#include "shared/os-compatibility.h"
@ -98,14 +99,14 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return -1;
}

@ -31,6 +31,7 @@
#include <stdbool.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <wayland-client.h>
@ -70,15 +71,15 @@ create_shm_buffer(struct touch *touch)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
exit(1);
}
touch->data =
mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (touch->data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
exit(1);
}

@ -29,6 +29,7 @@
#include <string.h>
#include <time.h>
#include <math.h>
#include <errno.h>
#include <cairo.h>
#include <wayland-client.h>
@ -273,7 +274,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -29,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <errno.h>
#include <linux/input.h>
#include <cairo.h>
@ -290,7 +291,8 @@ main(int argc, char *argv[])
stacking.display = display_create(&argc, argv);
if (stacking.display == NULL) {
fprintf(stderr, "Failed to create display: %m\n");
fprintf(stderr, "Failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -32,6 +32,7 @@
#include <cairo.h>
#include <math.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
@ -788,7 +789,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -3087,11 +3087,12 @@ terminal_run(struct terminal *terminal, const char *path)
setenv("TERM", option_term, 1);
setenv("COLORTERM", option_term, 1);
if (execl(path, path, NULL)) {
printf("exec failed: %m\n");
printf("exec failed: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
} else if (pid < 0) {
fprintf(stderr, "failed to fork and create pty (%m).\n");
fprintf(stderr, "failed to fork and create pty (%s).\n",
strerror(errno));
return -1;
}
@ -3158,7 +3159,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -29,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <cairo.h>
#include <linux/input.h>
@ -263,7 +264,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -276,8 +276,8 @@ setup_out_fd(const char *output, const char *outfd)
O_WRONLY | O_APPEND | O_CREAT, 0644);
if (fd < 0) {
fprintf(stderr,
"Error: opening file '%s' failed: %m\n",
output);
"Error: opening file '%s' failed: %s\n",
output, strerror(errno));
}
return fd;
}
@ -290,7 +290,8 @@ setup_out_fd(const char *output, const char *outfd)
flags = fcntl(fd, F_GETFL);
if (flags == -1) {
fprintf(stderr,
"Error: cannot use file descriptor %d: %m\n", fd);
"Error: cannot use file descriptor %d: %s\n", fd,
strerror(errno));
return -1;
}
@ -432,7 +433,8 @@ main(int argc, char **argv)
app.dpy = wl_display_connect(NULL);
if (!app.dpy) {
fprintf(stderr, "Error: Could not connect to Wayland display: %m\n");
fprintf(stderr, "Error: Could not connect to Wayland display: %s\n",
strerror(errno));
ret = 1;
goto out_parse;
}

@ -1856,7 +1856,8 @@ main(int argc, char **argv)
info.display = wl_display_connect(NULL);
if (!info.display) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}

@ -740,14 +740,14 @@ make_shm_pool(struct display *display, int size, void **data)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return NULL;
}
*data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (*data == MAP_FAILED) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return NULL;
}
@ -6168,7 +6168,8 @@ display_create(int *argc, char *argv[])
d->display = wl_display_connect(NULL);
if (d->display == NULL) {
fprintf(stderr, "failed to connect to Wayland display: %m\n");
fprintf(stderr, "failed to connect to Wayland display: %s\n",
strerror(errno));
free(d);
return NULL;
}
@ -6195,7 +6196,8 @@ display_create(int *argc, char *argv[])
wl_registry_add_listener(d->registry, &registry_listener, d);
if (wl_display_roundtrip(d->display) < 0) {
fprintf(stderr, "Failed to process Wayland connection: %m\n");
fprintf(stderr, "Failed to process Wayland connection: %s\n",
strerror(errno));
return NULL;
}
@ -6531,7 +6533,8 @@ toytimer_fire(struct task *tsk, uint32_t events)
* readable and getting here, there'll be nothing to
* read and we get EAGAIN. */
if (errno != EAGAIN)
fprintf(stderr, "timer read failed: %m\n");
fprintf(stderr, "timer read failed: %s\n",
strerror(errno));
return;
}
@ -6546,7 +6549,8 @@ toytimer_init(struct toytimer *tt, clockid_t clock, struct display *display,
tt->fd = timerfd_create(clock, TFD_CLOEXEC | TFD_NONBLOCK);
if (tt->fd == -1) {
fprintf(stderr, "creating timer failed: %m\n");
fprintf(stderr, "creating timer failed: %s\n",
strerror(errno));
abort();
}
@ -6571,7 +6575,7 @@ toytimer_arm(struct toytimer *tt, const struct itimerspec *its)
ret = timerfd_settime(tt->fd, 0, its, NULL);
if (ret < 0) {
fprintf(stderr, "timer setup failed: %m\n");
fprintf(stderr, "timer setup failed: %s\n", strerror(errno));
abort();
}
}

@ -365,7 +365,7 @@ sigchld_handler(int signal_number, void *data)
}
if (pid < 0 && errno != ECHILD)
weston_log("waitpid error %m\n");
weston_log("waitpid error %s\n", strerror(errno));
return 1;
}
@ -391,7 +391,7 @@ child_client_exec(int sockfd, const char *path)
* non-CLOEXEC fd to pass through exec. */
clientfd = dup(sockfd);
if (clientfd == -1) {
weston_log("compositor: dup failed: %m\n");
weston_log("compositor: dup failed: %s\n", strerror(errno));
return;
}
@ -399,8 +399,8 @@ child_client_exec(int sockfd, const char *path)
setenv("WAYLAND_SOCKET", s, 1);
if (execl(path, path, NULL) < 0)
weston_log("compositor: executing '%s' failed: %m\n",
path);
weston_log("compositor: executing '%s' failed: %s\n",
path, strerror(errno));
}
WL_EXPORT struct wl_client *
@ -417,8 +417,8 @@ weston_client_launch(struct weston_compositor *compositor,
if (os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, sv) < 0) {
weston_log("weston_client_launch: "
"socketpair failed while launching '%s': %m\n",
path);
"socketpair failed while launching '%s': %s\n",
path, strerror(errno));
return NULL;
}
@ -427,7 +427,8 @@ weston_client_launch(struct weston_compositor *compositor,
close(sv[0]);
close(sv[1]);
weston_log("weston_client_launch: "
"fork failed while launching '%s': %m\n", path);
"fork failed while launching '%s': %s\n", path,
strerror(errno));
return NULL;
}
@ -812,13 +813,15 @@ weston_create_listening_socket(struct wl_display *display, const char *socket_na
{
if (socket_name) {
if (wl_display_add_socket(display, socket_name)) {
weston_log("fatal: failed to add socket: %m\n");
weston_log("fatal: failed to add socket: %s\n",
strerror(errno));
return -1;
}
} else {
socket_name = wl_display_add_socket_auto(display);
if (!socket_name) {
weston_log("fatal: failed to add socket: %m\n");
weston_log("fatal: failed to add socket: %s\n",
strerror(errno));
return -1;
}
}
@ -3083,7 +3086,8 @@ int main(int argc, char *argv[])
if (fd != -1) {
primary_client = wl_client_create(display, fd);
if (!primary_client) {
weston_log("fatal: failed to add client: %m\n");
weston_log("fatal: failed to add client: %s\n",
strerror(errno));
goto out;
}
primary_client_destroyed.notify =

@ -207,7 +207,7 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_str == MAP_FAILED) {
weston_log("mmap failed: %m\n");
weston_log("mmap failed: %s\n", strerror(errno));
goto error;
}
@ -462,13 +462,13 @@ shared_output_get_shm_buffer(struct shared_output *so)
fd = os_create_anonymous_file(height * stride);
if (fd < 0) {
weston_log("os_create_anonymous_file: %m\n");
weston_log("os_create_anonymous_file: %s\n", strerror(errno));
return NULL;
}
data = mmap(NULL, height * stride, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
weston_log("mmap: %m\n");
weston_log("mmap: %s\n", strerror(errno));
goto out_close;
}
@ -940,7 +940,7 @@ shared_output_create(struct weston_output *output, int parent_fd)
so->parent.surface =
wl_compositor_create_surface(so->parent.compositor);
if (!so->parent.surface) {
weston_log("Screen share failed: %m\n");
weston_log("Screen share failed: %s\n", strerror(errno));
goto err_display;
}
@ -950,7 +950,7 @@ shared_output_create(struct weston_output *output, int parent_fd)
so->parent.output,
output->current_mode->refresh);
if (!so->parent.mode_feedback) {
weston_log("Screen share failed: %m\n");
weston_log("Screen share failed: %s\n", strerror(errno));
goto err_display;
}
zwp_fullscreen_shell_mode_feedback_v1_add_listener(so->parent.mode_feedback,
@ -964,7 +964,7 @@ shared_output_create(struct weston_output *output, int parent_fd)
wl_event_loop_add_fd(loop, epoll_fd, WL_EVENT_READABLE,
shared_output_handle_event, so);
if (!so->event_source) {
weston_log("Screen share failed: %m\n");
weston_log("Screen share failed: %s\n", strerror(errno));
goto err_display;
}
@ -1033,7 +1033,8 @@ weston_output_share(struct weston_output *output, const char* command)
};
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
weston_log("weston_output_share: socketpair failed: %m\n");
weston_log("weston_output_share: socketpair failed: %s\n",
strerror(errno));
return NULL;
}
@ -1042,7 +1043,8 @@ weston_output_share(struct weston_output *output, const char* command)
if (pid == -1) {
close(sv[0]);
close(sv[1]);
weston_log("weston_output_share: fork failed: %m\n");
weston_log("weston_output_share: fork failed: %s\n",
strerror(errno));
return NULL;
}
@ -1054,13 +1056,15 @@ weston_output_share(struct weston_output *output, const char* command)
/* Launch clients as the user. Do not launch clients with
* wrong euid. */
if (seteuid(getuid()) == -1) {
weston_log("weston_output_share: setuid failed: %m\n");
weston_log("weston_output_share: setuid failed: %s\n",
strerror(errno));
abort();
}
sv[1] = dup(sv[1]);
if (sv[1] == -1) {
weston_log("weston_output_share: dup failed: %m\n");
weston_log("weston_output_share: dup failed: %s\n",
strerror(errno));
abort();
}
@ -1068,7 +1072,8 @@ weston_output_share(struct weston_output *output, const char* command)
setenv("WAYLAND_SERVER_SOCKET", str, 1);
execv(argv[0], argv);
weston_log("weston_output_share: exec failed: %m\n");
weston_log("weston_output_share: exec failed: %s\n",
strerror(errno));
abort();
} else {
close(sv[1]);

@ -27,6 +27,8 @@
#include "config.h"
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <sys/socket.h>
#include <libweston/libweston.h>
@ -128,9 +130,10 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
NULL) < 0)
weston_log("exec of '%s %s -rootless "
"-listen %s -listen %s -wm %s "
"-terminate' failed: %m\n",
"-terminate' failed: %s\n",
xserver, display,
abstract_fd_str, unix_fd_str, wm_fd_str);
abstract_fd_str, unix_fd_str, wm_fd_str,
strerror(errno));
fail:
_exit(EXIT_FAILURE);

@ -665,7 +665,8 @@ drm_output_pageflip_timer_create(struct drm_output *output)
output);
if (output->pageflip_timer == NULL) {
weston_log("creating drm pageflip timer failed: %m\n");
weston_log("creating drm pageflip timer failed: %s\n",
strerror(errno));
return -1;
}
@ -1083,7 +1084,7 @@ drm_fb_create_dumb(struct drm_backend *b, int width, int height,
fb->fd = b->drm.fd;
if (drm_fb_addfb(b, fb) != 0) {
weston_log("failed to create kms fb: %m\n");
weston_log("failed to create kms fb: %s\n", strerror(errno));
goto err_bo;
}
@ -1333,7 +1334,8 @@ drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_backend *backend,
if (drm_fb_addfb(backend, fb) != 0) {
if (type == BUFFER_GBM_SURFACE)
weston_log("failed to create kms fb: %m\n");
weston_log("failed to create kms fb: %s\n",
strerror(errno));
goto err_free;
}
@ -2104,7 +2106,8 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage)
bo = gbm_surface_lock_front_buffer(output->gbm_surface);
if (!bo) {
weston_log("failed to lock front buffer: %m\n");
weston_log("failed to lock front buffer: %s\n",
strerror(errno));
return NULL;
}
@ -2228,7 +2231,7 @@ drm_output_set_gamma(struct weston_output *output_base,
output->crtc_id,
size, r, g, b);
if (rc)
weston_log("set gamma failed: %m\n");
weston_log("set gamma failed: %s\n", strerror(errno));
}
/* Determine the type of vblank synchronization to use for the output.
@ -2302,20 +2305,23 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
ret = drmModeSetPlane(backend->drm.fd, p->plane_id,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
if (ret)
weston_log("drmModeSetPlane failed disable: %m\n");
weston_log("drmModeSetPlane failed disable: %s\n",
strerror(errno));
}
if (output->cursor_plane) {
ret = drmModeSetCursor(backend->drm.fd, output->crtc_id,
0, 0, 0);
if (ret)
weston_log("drmModeSetCursor failed disable: %m\n");
weston_log("drmModeSetCursor failed disable: %s\n",
strerror(errno));
}
ret = drmModeSetCrtc(backend->drm.fd, output->crtc_id, 0, 0, 0,
NULL, 0, NULL);
if (ret)
weston_log("drmModeSetCrtc failed disabling: %m\n");
weston_log("drmModeSetCrtc failed disabling: %s\n",
strerror(errno));
drm_output_assign_state(state, DRM_STATE_APPLY_SYNC);
weston_compositor_read_presentation_clock(output->base.compositor, &now);
@ -2356,7 +2362,7 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
connectors, n_conn,
&mode->mode_info);
if (ret) {
weston_log("set mode failed: %m\n");
weston_log("set mode failed: %s\n", strerror(errno));
goto err;
}
}
@ -2369,7 +2375,7 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
if (drmModePageFlip(backend->drm.fd, output->crtc_id,
scanout_state->fb->fb_id,
DRM_MODE_PAGE_FLIP_EVENT, output) < 0) {
weston_log("queueing pageflip failed: %m\n");
weston_log("queueing pageflip failed: %s\n", strerror(errno));
goto err;
}
@ -2529,7 +2535,8 @@ drm_mode_ensure_blob(struct drm_backend *backend, struct drm_mode *mode)
sizeof(mode->mode_info),
&mode->blob_id);
if (ret != 0)
weston_log("failed to create mode property blob: %m\n");
weston_log("failed to create mode property blob: %s\n",
strerror(errno));
drm_debug(backend, "\t\t\t[atomic] created new mode blob %lu for %s\n",
(unsigned long) mode->blob_id, mode->mode_info.name);
@ -2828,7 +2835,8 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state,
}
if (ret != 0) {
weston_log("atomic: couldn't commit new state: %m\n");
weston_log("atomic: couldn't commit new state: %s\n",
strerror(errno));
goto out;
}
@ -3104,7 +3112,8 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
ret = drm_pending_state_apply(pending_state);
if (ret != 0) {
weston_log("applying repaint-start state failed: %m\n");
weston_log("applying repaint-start state failed: %s\n",
strerror(errno));
goto finish_frame;
}
@ -3462,7 +3471,7 @@ cursor_bo_update(struct drm_plane_state *plane_state, struct weston_view *ev)
wl_shm_buffer_end_access(buffer->shm_buffer);
if (gbm_bo_write(bo, buf, sizeof buf) < 0)
weston_log("failed update cursor: %m\n");
weston_log("failed update cursor: %s\n", strerror(errno));
}
static struct drm_plane_state *
@ -3608,7 +3617,8 @@ drm_output_set_cursor(struct drm_output_state *output_state)
handle = gbm_bo_get_handle(bo).s32;
if (drmModeSetCursor(b->drm.fd, output->crtc_id, handle,
b->cursor_width, b->cursor_height)) {
weston_log("failed to set cursor: %m\n");
weston_log("failed to set cursor: %s\n",
strerror(errno));
goto err;
}
}
@ -3618,7 +3628,7 @@ drm_output_set_cursor(struct drm_output_state *output_state)
if (drmModeMoveCursor(b->drm.fd, output->crtc_id,
state->dest_x, state->dest_y)) {
weston_log("failed to move cursor: %m\n");
weston_log("failed to move cursor: %s\n", strerror(errno));
goto err;
}
@ -7057,7 +7067,7 @@ recorder_frame_notify(struct wl_listener *listener, void *data)
ret = vaapi_recorder_frame(output->recorder, fd,
output->scanout_plane->state_cur->fb->strides[0]);
if (ret < 0) {
weston_log("[libva recorder] aborted: %m\n");
weston_log("[libva recorder] aborted: %s\n", strerror(errno));
recorder_destroy(output);
}
}

@ -34,6 +34,7 @@
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <linux/input.h>
@ -302,20 +303,23 @@ wayland_output_get_shm_buffer(struct wayland_output *output)
fd = os_create_anonymous_file(height * stride);
if (fd < 0) {
weston_log("could not create an anonymous file buffer: %m\n");
weston_log("could not create an anonymous file buffer: %s\n",
strerror(errno));
return NULL;
}
data = mmap(NULL, height * stride, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) {
weston_log("could not mmap %d memory for data: %m\n", height * stride);
weston_log("could not mmap %d memory for data: %s\n", height * stride,
strerror(errno));
close(fd);
return NULL;
}
sb = zalloc(sizeof *sb);
if (sb == NULL) {
weston_log("could not zalloc %zu memory for sb: %m\n", sizeof *sb);
weston_log("could not zalloc %zu memory for sb: %s\n", sizeof *sb,
strerror(errno));
close(fd);
munmap(data, height * stride);
return NULL;
@ -1917,7 +1921,7 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,
if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_str == MAP_FAILED) {
weston_log("mmap failed: %m\n");
weston_log("mmap failed: %s\n", strerror(errno));
goto error;
}
@ -2729,7 +2733,8 @@ wayland_backend_create(struct weston_compositor *compositor,
b->parent.wl_display = wl_display_connect(new_config->display_name);
if (b->parent.wl_display == NULL) {
weston_log("Error: Failed to connect to parent Wayland compositor: %m\n");
weston_log("Error: Failed to connect to parent Wayland compositor: %s\n",
strerror(errno));
weston_log_continue(STAMP_SPACE "display option: %s, WAYLAND_DISPLAY=%s\n",
new_config->display_name ?: "(none)",
getenv("WAYLAND_DISPLAY") ?: "(not set)");

@ -7020,8 +7020,9 @@ weston_compositor_read_presentation_clock(
if (!warned)
weston_log("Error: failure to read "
"the presentation clock %#x: '%m' (%d)\n",
compositor->presentation_clock, errno);
"the presentation clock %#x: '%s' (%d)\n",
compositor->presentation_clock,
strerror(errno), errno);
warned = true;
}
}

@ -37,6 +37,7 @@
#include <values.h>
#include <fcntl.h>
#include <limits.h>
#include <errno.h>
#include "shared/helpers.h"
#include "shared/os-compatibility.h"
@ -2089,8 +2090,9 @@ weston_keyboard_send_keymap(struct weston_keyboard *kbd, struct wl_resource *res
fd = os_create_anonymous_file(xkb_info->keymap_size);
if (fd < 0) {
weston_log("creating a keymap file for %lu bytes failed: %m\n",
(unsigned long) xkb_info->keymap_size);
weston_log("creating a keymap file for %lu bytes failed: %s\n",
(unsigned long) xkb_info->keymap_size,
strerror(errno));
return;
}

@ -32,6 +32,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/vt.h>
@ -129,14 +130,16 @@ setup_tty(struct launcher_direct *launcher, int tty)
if (tty == 0) {
launcher->tty = dup(tty);
if (launcher->tty == -1) {
weston_log("couldn't dup stdin: %m\n");
weston_log("couldn't dup stdin: %s\n",
strerror(errno));
return -1;
}
} else {
snprintf(tty_device, sizeof tty_device, "/dev/tty%d", tty);
launcher->tty = open(tty_device, O_RDWR | O_CLOEXEC);
if (launcher->tty == -1) {
weston_log("couldn't open tty %s: %m\n", tty_device);
weston_log("couldn't open tty %s: %s\n", tty_device,
strerror(errno));
return -1;
}
}
@ -151,7 +154,7 @@ setup_tty(struct launcher_direct *launcher, int tty)
ret = ioctl(launcher->tty, KDGETMODE, &kd_mode);
if (ret) {
weston_log("failed to get VT mode: %m\n");
weston_log("failed to get VT mode: %s\n", strerror(errno));
return -1;
}
if (kd_mode != KD_TEXT) {
@ -164,19 +167,22 @@ setup_tty(struct launcher_direct *launcher, int tty)
ioctl(launcher->tty, VT_WAITACTIVE, minor(buf.st_rdev));
if (ioctl(launcher->tty, KDGKBMODE, &launcher->kb_mode)) {
weston_log("failed to read keyboard mode: %m\n");
weston_log("failed to read keyboard mode: %s\n",
strerror(errno));
goto err_close;
}
if (ioctl(launcher->tty, KDSKBMUTE, 1) &&
ioctl(launcher->tty, KDSKBMODE, K_OFF)) {
weston_log("failed to set K_OFF keyboard mode: %m\n");
weston_log("failed to set K_OFF keyboard mode: %s\n",
strerror(errno));
goto err_close;
}
ret = ioctl(launcher->tty, KDSETMODE, KD_GRAPHICS);
if (ret) {
weston_log("failed to set KD_GRAPHICS mode on tty: %m\n");
weston_log("failed to set KD_GRAPHICS mode on tty: %s\n",
strerror(errno));
goto err_close;
}
@ -255,10 +261,12 @@ launcher_direct_restore(struct weston_launcher *launcher_base)
if (ioctl(launcher->tty, KDSKBMUTE, 0) &&
ioctl(launcher->tty, KDSKBMODE, launcher->kb_mode))
weston_log("failed to restore kb mode: %m\n");
weston_log("failed to restore kb mode: %s\n",
strerror(errno));
if (ioctl(launcher->tty, KDSETMODE, KD_TEXT))
weston_log("failed to set KD_TEXT mode on tty: %m\n");
weston_log("failed to set KD_TEXT mode on tty: %s\n",
strerror(errno));
/* We have to drop master before we switch the VT back in
* VT_AUTO, so we don't risk switching to a VT with another

@ -225,7 +225,7 @@ launcher_logind_close(struct weston_launcher *launcher, int fd)
r = fstat(fd, &st);
close(fd);
if (r < 0) {
weston_log("logind: cannot fstat fd: %m\n");
weston_log("logind: cannot fstat fd: %s\n", strerror(errno));
return;
}

@ -169,10 +169,12 @@ launcher_weston_launch_restore(struct weston_launcher *launcher_base)
if (ioctl(launcher->tty, KDSKBMUTE, 0) &&
ioctl(launcher->tty, KDSKBMODE, launcher->kb_mode))
weston_log("failed to restore kb mode: %m\n");
weston_log("failed to restore kb mode: %s\n",
strerror(errno));
if (ioctl(launcher->tty, KDSETMODE, KD_TEXT))
weston_log("failed to set KD_TEXT mode on tty: %m\n");
weston_log("failed to set KD_TEXT mode on tty: %s\n",
strerror(errno));
/* We have to drop master before we switch the VT back in
* VT_AUTO, so we don't risk switching to a VT with another

@ -32,6 +32,7 @@
#include <linux/input.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/uio.h>
#include <libweston/libweston.h>
@ -431,7 +432,8 @@ weston_recorder_create(struct weston_output *output, const char *filename)
O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
if (recorder->fd < 0) {
weston_log("problem opening output file %s: %m\n", filename);
weston_log("problem opening output file %s: %s\n", filename,
strerror(errno));
goto err_recorder;
}

@ -128,7 +128,8 @@ read_groups(int *ngroups)
n = getgroups(0, NULL);
if (n < 0) {
fprintf(stderr, "Unable to retrieve groups: %m\n");
fprintf(stderr, "Unable to retrieve groups: %s\n",
strerror(errno));
return NULL;
}
@ -137,7 +138,8 @@ read_groups(int *ngroups)
return NULL;
if (getgroups(n, groups) < 0) {
fprintf(stderr, "Unable to retrieve groups: %m\n");
fprintf(stderr, "Unable to retrieve groups: %s\n",
strerror(errno));
free(groups);
return NULL;
}
@ -325,8 +327,8 @@ handle_open(struct weston_launch *wl, struct msghdr *msg, ssize_t len)
fd = open(message->path, message->flags);
if (fd < 0) {
fprintf(stderr, "Error opening device %s: %m\n",
message->path);
fprintf(stderr, "Error opening device %s: %s\n",
message->path, strerror(errno));
goto err0;
}
@ -439,10 +441,12 @@ quit(struct weston_launch *wl, int status)
if (ioctl(wl->tty, KDSKBMUTE, 0) &&
ioctl(wl->tty, KDSKBMODE, wl->kb_mode))
fprintf(stderr, "failed to restore keyboard mode: %m\n");
fprintf(stderr, "failed to restore keyboard mode: %s\n",
strerror(errno));
if (ioctl(wl->tty, KDSETMODE, KD_TEXT))
fprintf(stderr, "failed to set KD_TEXT mode on tty: %m\n");
fprintf(stderr, "failed to set KD_TEXT mode on tty: %s\n",
strerror(errno));
/* We have to drop master before we switch the VT back in
* VT_AUTO, so we don't risk switching to a VT with another

@ -33,6 +33,7 @@
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <errno.h>
#include <libweston/libweston.h>
#include "compositor/weston.h"
@ -198,7 +199,8 @@ idle_launch_client(void *data)
pid = fork();
if (pid == -1) {
weston_log("fatal: failed to fork '%s': %m\n", launcher->exe);
weston_log("fatal: failed to fork '%s': %s\n", launcher->exe,
strerror(errno));
weston_compositor_exit_with_code(launcher->compositor,
EXIT_FAILURE);
return;
@ -208,8 +210,8 @@ idle_launch_client(void *data)
sigfillset(&allsigs);
sigprocmask(SIG_UNBLOCK, &allsigs, NULL);
execl(launcher->exe, launcher->exe, NULL);
weston_log("compositor: executing '%s' failed: %m\n",
launcher->exe);
weston_log("compositor: executing '%s' failed: %s\n",
launcher->exe, strerror(errno));
_exit(EXIT_FAILURE);
}

@ -104,7 +104,7 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration
run_test(t, test_data, iteration); /* never returns */
if (waitid(P_ALL, 0, &info, WEXITED)) {
fprintf(stderr, "waitid failed: %m\n");
fprintf(stderr, "waitid failed: %s\n", strerror(errno));
abort();
}

@ -31,6 +31,7 @@
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <libweston/libweston.h>
#include "compositor/weston.h"
@ -649,7 +650,8 @@ idle_launch_client(void *data)
sigfillset(&allsigs);
sigprocmask(SIG_UNBLOCK, &allsigs, NULL);
execl(path, path, NULL);
weston_log("compositor: executing '%s' failed: %m\n", path);
weston_log("compositor: executing '%s' failed: %s\n", path,
strerror(errno));
exit(EXIT_FAILURE);
}

@ -100,7 +100,8 @@ bind_to_abstract_socket(int display)
"%c/tmp/.X11-unix/X%d", 0, display);
size = offsetof(struct sockaddr_un, sun_path) + name_size;
if (bind(fd, (struct sockaddr *) &addr, size) < 0) {
weston_log("failed to bind to @%s: %m\n", addr.sun_path + 1);
weston_log("failed to bind to @%s: %s\n", addr.sun_path + 1,
strerror(errno));
close(fd);
return -1;
}
@ -130,7 +131,8 @@ bind_to_unix_socket(int display)
size = offsetof(struct sockaddr_un, sun_path) + name_size;
unlink(addr.sun_path);
if (bind(fd, (struct sockaddr *) &addr, size) < 0) {
weston_log("failed to bind to %s: %m\n", addr.sun_path);
weston_log("failed to bind to %s: %s\n", addr.sun_path,
strerror(errno));
close(fd);
return -1;
}

@ -30,6 +30,7 @@
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "xwayland.h"
#include "shared/helpers.h"
@ -59,7 +60,7 @@ writable_callback(int fd, uint32_t mask, void *data)
wl_event_source_remove(wm->property_source);
wm->property_source = NULL;
close(fd);
weston_log("write error to target fd: %m\n");
weston_log("write error to target fd: %s\n", strerror(errno));
return 1;
}
@ -401,7 +402,8 @@ weston_wm_read_data_source(int fd, uint32_t mask, void *data)
len = read(fd, p, available);
if (len == -1) {
weston_log("read error from data source: %m\n");
weston_log("read error from data source: %s\n",
strerror(errno));
weston_wm_send_selection_notify(wm, XCB_ATOM_NONE);
if (wm->property_source)
wl_event_source_remove(wm->property_source);
@ -494,7 +496,7 @@ weston_wm_send_data(struct weston_wm *wm, xcb_atom_t target, const char *mime_ty
int p[2];
if (pipe2(p, O_CLOEXEC | O_NONBLOCK) == -1) {
weston_log("pipe2 failed: %m\n");
weston_log("pipe2 failed: %s\n", strerror(errno));
weston_wm_send_selection_notify(wm, XCB_ATOM_NONE);
return;
}

Loading…
Cancel
Save