diff options
author | Alex Riesen <raa.lkml@gmail.com> | 2006-01-05 09:58:06 +0100 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-01-05 17:22:47 -0800 |
commit | 781411ed46400f95c45c5ca103769288025b39d6 (patch) | |
tree | ba6966a4f4e7a88b4001f4489a53fb460bbd56b3 | |
parent | trivial: retval of waitpid is not errno (diff) | |
download | tgif-781411ed46400f95c45c5ca103769288025b39d6.tar.xz |
trivial: O_EXCL makes O_TRUNC redundant
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r-- | apply.c | 2 | ||||
-rw-r--r-- | entry.c | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -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) { @@ -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) |