aboutsummaryrefslogtreecommitdiff
path: root/libXaw/src/AsciiSrc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libXaw/src/AsciiSrc.c')
-rw-r--r--libXaw/src/AsciiSrc.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libXaw/src/AsciiSrc.c b/libXaw/src/AsciiSrc.c
index eb569fc9f..245a65464 100644
--- a/libXaw/src/AsciiSrc.c
+++ b/libXaw/src/AsciiSrc.c
@@ -1,5 +1,3 @@
-/* $Xorg: AsciiSrc.c,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ */
-
/*
Copyright 1989, 1994, 1998 The Open Group
@@ -26,8 +24,6 @@ in this Software without prior written authorization from The Open Group.
*/
-/* $XFree86: xc/lib/Xaw/AsciiSrc.c,v 1.33 2002/07/04 17:04:20 paulo Exp $ */
-
/*
* AsciiSrc.c - AsciiSrc object. (For use with the text widget).
*
@@ -1292,10 +1288,14 @@ WriteToFile(String string, String name, unsigned length)
{
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 +1349,10 @@ WritePiecesToFile(AsciiSrcObject src, String name)
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);