git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v1 2/2] read-cache: make sure file handles are not inherited by child processes

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Sep 6, 2016, 11:41 UTC
Message-ID
<alpine.DEB.2.20.1609061339230.129229@virtualbox>
In-Reply-To
<20160905211111.72956-3-larsxschneider@gmail.com>
Hi Lars,
On Mon, 5 Sep 2016, larsxschneider@gmail.com wrote:
> [... commit message ...]
Makes sense.
Show 10 quoted lines
> diff --git a/read-cache.c b/read-cache.c
> index 491e52d..02f74d3 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -156,7 +156,7 @@ void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
>  static int ce_compare_data(const struct cache_entry *ce, struct stat *st)
>  {
>  	int match = -1;
> -	int fd = open(ce->name, O_RDONLY);
> +	int fd = open(ce->name, O_RDONLY | O_CLOEXEC);

Eric's comment on 1/2 applies here, too, of course: should this cause any problems on non-Windows platforms, we always have that FD_CLOEXEC thing that we could probably use to fix it.

But let's cross that bridge when (or better: if) we get there.

Ciao, Dscho

Previous: larsxschneider@gmail.comNext: Eric Wong
Message 9 of 15 in “Use CLOEXEC to avoid fd leaks”
  1. 0/2 Use CLOEXEC to avoid fd leakslarsxschneider@gmail.com, Sep 5, 2016
  2. 1/2 sha1_file: open window into packfiles with CLOEXEClarsxschneider@gmail.com, Sep 5, 2016
  3. Eric WongSep 5, 2016
  4. Jakub NarębskiSep 6, 2016
  5. Johannes SchindelinSep 6, 2016
  6. Lars SchneiderSep 7, 2016
  7. Eric WongSep 7, 2016
  8. 2/2 read-cache: make sure file handles are not inherited by child processeslarsxschneider@gmail.com, Sep 5, 2016
  9. Johannes SchindelinSep 6, 2016
  10. Eric WongSep 6, 2016
  11. Lars SchneiderSep 7, 2016
  12. Eric WongSep 7, 2016
  13. Junio C HamanoSep 7, 2016
  14. Lars SchneiderSep 8, 2016
  15. Junio C HamanoSep 8, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.