--- libXaw-1.0.7/src/AsciiSrc.c.orig 2009-10-20 10:17:36.000000000 +0200 +++ libXaw-1.0.7/src/AsciiSrc.c 2009-10-20 10:19:25.000000000 +0200 @@ -1292,10 +1292,14 @@ WriteToFile(String string, String name, { int fd; - if ((fd = creat(name, 0666)) == -1 - || write(fd, string, length) == -1) + if (fd = creat(name, 0666) == -1) return (False); + if (write(fd, string, length) == -1) { + close(fd) + return (False); + } + if (close(fd) == -1) return (False); @@ -1349,8 +1353,10 @@ WritePiecesToFile(AsciiSrcObject src, St return (False); for (piece = src->ascii_src.first_piece; piece; piece = piece->next) - if (write(fd, piece->text, piece->used) == -1) + if (write(fd, piece->text, piece->used) == -1) { + close(fd); return (False); + } if (close(fd) == -1) return (False);