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

[PATCH] setup.c: remove needless argument passed to open in sanitize_stdfds

From
Ppedrodelyra@gmail.com <pedrodelyra@gmail.com>
Date
Nov 25, 2018, 16:20 UTC
Message-ID
<20181125162008.30065-1-pedrodelyra@gmail.com>
From: Pedro de Lyra <pedrodelyra@gmail.com>
Signed-off-by: Pedro de Lyra <pedrodelyra@gmail.com>
---
According to POSIX manual pages, the open() system call's mode argument specifies the file mode bits to be applied when a new file is created. If neither O_CREAT nor O_TMPFILE is specified, then mode is ignored. So I guess that 0 argument only confuses the reader.
 setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.c b/setup.c
index 1be5037f1..d4fd14bb7 100644
--- a/setup.c
+++ b/setup.c
@@ -1228,7 +1228,7 @@ const char *resolve_gitdir_gently(const char *suspect, int *return_error_code)
 /* if any standard file descriptor is missing open it to /dev/null */
 void sanitize_stdfds(void)
 {
-	int fd = open("/dev/null", O_RDWR, 0);
+	int fd = open("/dev/null", O_RDWR);
 	while (fd != -1 && fd < 2)
 		fd = dup(fd);
 	if (fd == -1)
-- 
2.17.1
Next: Junio C Hamano
Message 1 of 2 in “setup.c: remove needless argument passed to open in sanitize_stdfds”
  1. setup.c: remove needless argument passed to open in sanitize_stdfdspedrodelyra@gmail.com, Nov 25, 2018
  2. Junio C HamanoNov 26, 2018

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.