dovecot-2.2: xml2text: Check for read()/write() failures and exi...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jun 16 12:48:49 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/fc40b1a6e962
changeset: 17495:fc40b1a6e962
user: Timo Sirainen <tss at iki.fi>
date: Mon Jun 16 15:35:07 2014 +0300
description:
xml2text: Check for read()/write() failures and exit if they fail.
diffstat:
src/plugins/fts/xml2text.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r 20e8ed98357b -r fc40b1a6e962 src/plugins/fts/xml2text.c
--- a/src/plugins/fts/xml2text.c Mon Jun 16 13:12:40 2014 +0300
+++ b/src/plugins/fts/xml2text.c Mon Jun 16 15:35:07 2014 +0300
@@ -23,16 +23,21 @@
block.data = buf;
block.size = ret;
parser->v.more(parser, &block);
- write(STDOUT_FILENO, block.data, block.size);
+ if (write(STDOUT_FILENO, block.data, block.size) < 0)
+ i_fatal("write(stdout) failed: %m");
}
+ if (ret < 0)
+ i_fatal("read(stdin) failed: %m");
for (;;) {
block.size = 0;
parser->v.more(parser, &block);
if (block.size == 0)
break;
- write(STDOUT_FILENO, block.data, block.size);
+ if (write(STDOUT_FILENO, block.data, block.size) < 0)
+ i_fatal("write(stdout) failed: %m");
}
lib_deinit();
+ return 0;
}
More information about the dovecot-cvs
mailing list