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

[PATCH 5/6] git_mkstemps_mode: don't set errno to EINVAL on exit.

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Feb 22, 2010, 22:32 UTC
Message-ID
<1266877936-13537-6-git-send-email-Matthieu.Moy@imag.fr>
In-Reply-To
<1266597207-32036-1-git-send-email-Matthieu.Moy@imag.fr>

When reaching the end of git_mkstemps_mode, at least one call to open() has been done, and errno has been set accordingly. Setting errno is therefore not necessary, and actually harmfull since callers can't distinguish e.g. permanent failure from ENOENT, which can just mean that we need to create the containing directory.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 path.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/path.c b/path.c
index 925039a..6f44921 100644
--- a/path.c
+++ b/path.c
@@ -222,7 +222,6 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
 	}
 	/* We return the null string if we can't find a unique file name.  */
 	pattern[0] = '\0';
-	errno = EINVAL;
 	return -1;
 }
 
-- 
1.7.0.54.gb6a04.dirty
Previous: Matthieu MoyNext: Matthieu Moy
Message 17 of 18 in “Allow Git repositories to be shared using POSIX ACLs”
  1. 0/4 Allow Git repositories to be shared using POSIX ACLsMatthieu Moy, Feb 19, 2010
  2. 1/4 Add a testcase for ACL with restrictive umask.Matthieu Moy, Feb 19, 2010
  3. 2/4 Move gitmkstemps to path.cMatthieu Moy, Feb 19, 2010
  4. 3/4 git_mkstemp_mode, xmkstemp_mode: variants of gitmkstemps with mode argument.Matthieu Moy, Feb 19, 2010
  5. 4/4 Use git_mkstemp_mode and xmkstemp_mode in odb_mkstemp, not chmod later.Matthieu Moy, Feb 19, 2010
  6. Junio C HamanoFeb 20, 2010
  7. Matthieu MoyFeb 22, 2010
  8. Junio C HamanoFeb 22, 2010
  9. Junio C HamanoFeb 22, 2010
  10. Matthieu MoyFeb 22, 2010
  11. Junio C HamanoFeb 19, 2010
  12. 0/6 Allow Git repositories to be shared using POSIX ACLsMatthieu Moy, Feb 22, 2010
  13. 1/6 Add a testcase for ACL with restrictive umask.Matthieu Moy, Feb 22, 2010
  14. 2/6 Move gitmkstemps to path.cMatthieu Moy, Feb 22, 2010
  15. 3/6 git_mkstemp_mode, xmkstemp_mode: variants of gitmkstemps with mode argument.Matthieu Moy, Feb 22, 2010
  16. 4/6 Use git_mkstemp_mode and xmkstemp_mode in odb_mkstemp, not chmod later.Matthieu Moy, Feb 22, 2010
  17. 5/6 git_mkstemps_mode: don't set errno to EINVAL on exit.Matthieu Moy, Feb 22, 2010
  18. 6/6 Use git_mkstemp_mode instead of plain mkstemp to create object filesMatthieu Moy, Feb 22, 2010

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.