[PATCH] refs/files-backend: remove unused open mode parameter

Subsystems: the rest

STALE1812d

2 messages, 2 authors, 2021-09-13 · open the first message on its own page

[PATCH] refs/files-backend: remove unused open mode parameter

From: René Scharfe <hidden>
Date: 2021-09-09 21:46:00

We only need to provide a mode if we are willing to let open(2) create
the file, which is not the case here, so drop the unnecessary parameter.

Signed-off-by: René Scharfe <redacted>
---
 refs/files-backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 677b7e4cdd..74c0385873 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1569,7 +1569,7 @@ static int log_ref_setup(struct files_ref_store *refs,
 			goto error;
 		}
 	} else {
-		*logfd = open(logfile, O_APPEND | O_WRONLY, 0666);
+		*logfd = open(logfile, O_APPEND | O_WRONLY);
 		if (*logfd < 0) {
 			if (errno == ENOENT || errno == EISDIR) {
 				/*
--
2.33.0

Re: [PATCH] refs/files-backend: remove unused open mode parameter

From: Han-Wen Nienhuys <hidden>
Date: 2021-09-13 10:12:17

On Thu, Sep 9, 2021 at 11:46 PM René Scharfe [off-list ref] wrote:
We only need to provide a mode if we are willing to let open(2) create
the file, which is not the case here, so drop the unnecessary parameter.
I was #today years old when I learned that C supports (a limited form
of) function signature overloading.

LGTM

-- 
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--
Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help