From: Alex Riesen Date: Thu, 5 Jan 2006 08:58:06 +0000 (+0100) Subject: trivial: O_EXCL makes O_TRUNC redundant X-Git-Tag: v1.0.7^2~18 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=781411ed46400f95c45c5ca103769288025b39d6;p=git.git trivial: O_EXCL makes O_TRUNC redundant Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- diff --git a/apply.c b/apply.c index d5e7bfdb4..9eba034e5 100644 --- a/apply.c +++ b/apply.c @@ -1588,7 +1588,7 @@ static int try_create_file(const char *path, unsigned int mode, const char *buf, 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 15b34eb6f..410b758aa 100644 --- a/entry.c +++ b/entry.c @@ -60,7 +60,7 @@ static void remove_subtree(const char *path) 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)