From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: Plug some fd leaks in bin_print
Date: Tue, 06 Jan 2015 22:35:31 -0800 [thread overview]
Message-ID: <150106223532.ZM1050@torch.brasslantern.com> (raw)
In-Reply-To: <1420590318-17047-1-git-send-email-mikachu@gmail.com>
I have some doubts about some of this. In fact I suspect that these are
mostly false-positives because the option letters tested in the if()
conditions preceding each of these goto's are (or should be) mutually
exclusive.
On Jan 7, 1:25am, Mikael Magnusson wrote:
}
} if (*eptr) {
} - zwarnnam(name, "number expcted after -%c: %s", 'C', argptr);
} - return 1;
} + zwarnnam(name, "number expected after -%c: %s", 'C', argptr);
} + ret = 1;
} + goto out_print;
} }
} if (nc <= 0) {
} zwarnnam(name, "invalid number of columns: %s", argptr);
} - return 1;
} + ret = 1;
} + goto out_print;
} }
I'm not sure what coverity had to say here, but these can't be right. The
descriptor should NOT be fflush()d on this error.
} queue_signals();
} zpushnode(bufstack, sepjoin(args, NULL, 0));
} unqueue_signals();
} - return 0;
} + goto out_print;
This can't be right either; there shouldn't be any output when pushing on
the buffer stack, so again we shouldn't be fflush()ing.
} zwarnnam(name, "option -S takes a single argument");
} - return 1;
} + ret = 1;
} + goto out_print;
Same complaint.
} if (OPT_ISSET(ops,'z') || OPT_ISSET(ops,'s')) {
} + if (fout != stdout)
} + fclose(fout);
} + fout = stdout;
Why is that needed when the very next couple of lines are going to over-
write fout with a different open?
I'm just going to quit complaining about the rest of these; I think
they're all incorrect. If nothing else, they shouldn't introduce the
possibility of printing BOTH an argument-parsing error AND a write-
failed error.
This needs to be looked at more closely.
--
Barton E. Schaefer
next prev parent reply other threads:[~2015-01-07 6:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-07 0:25 Mikael Magnusson
2015-01-07 1:21 ` Bart Schaefer
2015-01-07 3:15 ` Mikael Magnusson
2015-01-07 6:35 ` Bart Schaefer [this message]
2015-01-07 7:08 ` PATCH (differently) " Bart Schaefer
2015-01-07 7:14 ` Bart Schaefer
2015-01-07 8:26 ` Mikael Magnusson
2015-01-07 17:04 ` Bart Schaefer
2015-01-07 8:04 ` Mikael Magnusson
2015-01-07 8:06 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=150106223532.ZM1050@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).