commit 70885d0f9ad7966f720a91907dd397ef8321a57e
parent f1e5da6cdd8b02ed028ebf03d2697d0a949e925f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 11 Apr 2019 08:51:15 +0200
tweaks: use a signed type for a result that could be negative [coverity]
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -2414,7 +2414,8 @@ bool fix_spello(const char *word)
const char *do_int_speller(const char *tempfile_name)
{
char *misspellings, *pointer, *oneword;
- size_t blocksize, buffersize, bytesread, totalread;
+ long blocksize;
+ size_t buffersize, bytesread, totalread;
int spell_fd[2], sort_fd[2], uniq_fd[2], tempfile_fd = -1;
pid_t pid_spell, pid_sort, pid_uniq;
int spell_status, sort_status, uniq_status;
@@ -2514,7 +2515,9 @@ const char *do_int_speller(const char *tempfile_name)
}
/* Get the system pipe buffer size. */
- if ((blocksize = fpathconf(uniq_fd[0], _PC_PIPE_BUF)) < 1) {
+ blocksize = fpathconf(uniq_fd[0], _PC_PIPE_BUF);
+
+ if (blocksize < 1) {
close(uniq_fd[0]);
return _("Could not get size of pipe buffer");
}
@@ -2768,7 +2771,8 @@ void do_spell(void)
void do_linter(void)
{
char *read_buff, *read_buff_ptr, *read_buff_word;
- size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
+ long pipe_buff_size;
+ size_t read_buff_size, read_buff_read, bytesread;
size_t parsesuccess = 0;
int lint_status, lint_fd[2];
pid_t pid_lint;
@@ -2846,7 +2850,9 @@ void do_linter(void)
}
/* Get the system pipe buffer size. */
- if ((pipe_buff_size = fpathconf(lint_fd[0], _PC_PIPE_BUF)) < 1) {
+ pipe_buff_size = fpathconf(lint_fd[0], _PC_PIPE_BUF);
+
+ if (pipe_buff_size < 1) {
close(lint_fd[0]);
statusbar(_("Could not get size of pipe buffer"));
return;