[PATCH 5/8] os: FatalError if -displayfd writes fail
walter harms
wharms at bfs.de
Sun Apr 20 11:59:50 PDT 2014
Am 19.04.2014 00:21, schrieb Keith Packard:
> When the server is started with the -displayfd option, check to make
> sure that the writes succeed and give up running if they don't.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
> os/connection.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/os/connection.c b/os/connection.c
> index 5294e59..40d9ff3 100644
> --- a/os/connection.c
> +++ b/os/connection.c
> @@ -353,8 +353,10 @@ NotifyParentProcess(void)
> {
> #if !defined(WIN32)
> if (displayfd >= 0) {
> - write(displayfd, display, strlen(display));
> - write(displayfd, "\n", 1);
> + if (write(displayfd, display, strlen(display)) != strlen(display))
> + FatalError("Cannot write display number to fd %d\n", displayfd);
> + if (write(displayfd, "\n", 1) != 1)
> + FatalError("Cannot write display number to fd %d\n", displayfd);
> close(displayfd);
> displayfd = -1;
> }
i like to use dprintf() i such cases especialy since it is with POSIX-2008. Maybe it would be helpful here also ?
re,
wh
More information about the xorg-devel
mailing list