Re: [PATCH/RFC 2/2] change all unchecked calls to setenv to xsetenv
- From
Jeff King <peff@peff.net>
- Date
- Dec 13, 2011, 18:19 UTC
- Message-ID
- <20111213181946.GC1663@sigill.intra.peff.net>
- In-Reply-To
- <1323778227-1664-2-git-send-email-kusmabite@gmail.com>
On Tue, Dec 13, 2011 at 01:10:27PM +0100, Erik Faye-Lund wrote:
Show 11 quoted lines
> While reviewing some patches for Git for Windows, I realized that > we almost never check the return-value from setenv. This can lead > to quite surprising errors in unusual sitations. Mostly, an error > would probably be preferred. So here we go. > > However, I'm not at all convinced myself that all of these make > sense; in particular settings like GIT_EDITOR and GIT_PAGER could > perhaps benefit from having a warning printed rather than a hard > error. > > Thoughts?
I wrote almost the same patch once[1], but failed to actually push it through to acceptance. There weren't any objections, just that nobody really cared. I think it's a reasonable thing to do. The chances of setenv failing are very low, but the consequences could be quite bad.
There is also a call to putenv in git.c which should be checked (or could arguably just be converted to setenv).
-Peff
[1] http://thread.gmane.org/gmane.comp.version-control.git/134466