From: Alex Riesen <raa.lkml@gmail.com>
To: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: trivial: O_EXCL makes O_TRUNC redundant
Date: Thu, 5 Jan 2006 09:58:06 +0100 [thread overview]
Message-ID: <81b0412b0601050058y27eb492fu9a24f99e32e9f439@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 49 bytes --]
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
[-- Attachment #2: 0001-O_EXCL-makes-O_TRUNC-redundant.txt --]
[-- Type: text/plain, Size: 1127 bytes --]
Subject: [PATCH] O_EXCL makes O_TRUNC redundant
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
apply.c | 2 +-
entry.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
4d5e4d8d468c0eedf489104e9f02f86c635c8ac2
diff --git a/apply.c b/apply.c
index d5e7bfd..9eba034 100644
--- a/apply.c
+++ b/apply.c
@@ -1588,7 +1588,7 @@ static int try_create_file(const char *p
if (S_ISLNK(mode))
return symlink(buf, path);
- fd = open(path, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, (mode & 0100) ? 0777 : 0666);
+ fd = open(path, O_CREAT | O_EXCL | O_WRONLY, (mode & 0100) ? 0777 : 0666);
if (fd < 0)
return -1;
while (size) {
diff --git a/entry.c b/entry.c
index 15b34eb..410b758 100644
--- a/entry.c
+++ b/entry.c
@@ -60,7 +60,7 @@ static void remove_subtree(const char *p
static int create_file(const char *path, unsigned int mode)
{
mode = (mode & 0100) ? 0777 : 0666;
- return open(path, O_WRONLY | O_TRUNC | O_CREAT | O_EXCL, mode);
+ return open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
}
static int write_entry(struct cache_entry *ce, const char *path, struct checkout *state)
--
1.0.GIT
reply other threads:[~2006-01-05 9:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81b0412b0601050058y27eb492fu9a24f99e32e9f439@mail.gmail.com \
--to=raa.lkml@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).