summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/AsciiSrc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c
index cdc6277..0581040 100644
--- a/src/AsciiSrc.c
+++ b/src/AsciiSrc.c
@@ -907,10 +907,14 @@ WriteToFile(_Xconst _XtString string, _Xconst _XtString name)
{
int fd;
- if ( ((fd = creat(name, 0666)) == -1 ) ||
- (write(fd, string, sizeof(unsigned char) * strlen(string)) == -1) )
+ if ((fd = creat(name, 0666)) == -1)
return(FALSE);
+ if (write(fd, string, sizeof(unsigned char) * strlen(string)) == -1) {
+ close(fd);
+ return(FALSE);
+ }
+
if ( close(fd) == -1 )
return(FALSE);