@matheusbsbs / matheus-bagliano / commits / 781411ed46
Fork 0

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>

Alex Riesen committed Jan 5, 2006 at 09:58 UTC 781411ed46400f95c45c5ca103769288025b39d6
2 files changed +2 -2
apply.c
+1 -1
@@ -1588,7 +1588,7 @@ static int try_create_file(const char *path, unsigned int mode, const char *buf,
1588
1589 if (S_ISLNK(mode))
1590 return symlink(buf, path);
1591 - fd = open(path, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, (mode & 0100) ? 0777 : 0666);
1591 + fd = open(path, O_CREAT | O_EXCL | O_WRONLY, (mode & 0100) ? 0777 : 0666);
1592 if (fd < 0)
1593 return -1;
1594 while (size) {
entry.c
+1 -1
@@ -60,7 +60,7 @@ static void remove_subtree(const char *path)
60 static int create_file(const char *path, unsigned int mode)
61 {
62 mode = (mode & 0100) ? 0777 : 0666;
63 - return open(path, O_WRONLY | O_TRUNC | O_CREAT | O_EXCL, mode);
63 + return open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
64 }
65
66 static int write_entry(struct cache_entry *ce, const char *path, struct checkout *state)