X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=i3-dump-log%2Fmain.c;h=137554a4f1fefc36539c5ca8c40b5357b32a7e2a;hb=2bde6f080ecd5d0e2dccb20a1936a5d40af7ff84;hp=86b39338eae682f927bf93236658719bb03899cc;hpb=92000942039fa99d7334ca5099b467b0d3d17792;p=i3%2Fi3 diff --git a/i3-dump-log/main.c b/i3-dump-log/main.c index 86b39338..137554a4 100644 --- a/i3-dump-log/main.c +++ b/i3-dump-log/main.c @@ -2,7 +2,7 @@ * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager - * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) + * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * * i3-dump-log/main.c: Dumps the i3 SHM log to stdout. * @@ -43,8 +43,7 @@ static int check_for_wrap(void) { * of the log. */ wrap_count = header->wrap_count; const int len = (logbuffer + header->offset_last_wrap) - walk; - if (write(STDOUT_FILENO, walk, len) != len) - err(EXIT_FAILURE, "write()"); + swrite(STDOUT_FILENO, walk, len); walk = logbuffer + sizeof(i3_shmlog_header); return 1; } @@ -52,12 +51,8 @@ static int check_for_wrap(void) { static void print_till_end(void) { check_for_wrap(); const int len = (logbuffer + header->offset_next_write) - walk; - const int n = write(STDOUT_FILENO, walk, len); - if (len != n) - err(EXIT_FAILURE, "write()"); - if (n > 0) { - walk += n; - } + swrite(STDOUT_FILENO, walk, len); + walk += len; } int main(int argc, char *argv[]) {