Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
trivial: O_EXCL makes O_TRUNC redundant
author
Alex Riesen
<raa.lkml@gmail.com>
Thu, 5 Jan 2006 08:58:06 +0000
(09:58 +0100)
committer
Junio C Hamano
<junkio@cox.net>
Fri, 6 Jan 2006 01:22:47 +0000
(17:22 -0800)
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
apply.c
patch
|
blob
|
history
entry.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
7f272ca
)
diff --git
a/apply.c
b/apply.c
index d5e7bfdb4de1fe7990ae11e190537fd1c490d54c..9eba034e5d77bd54c7b6343ad54fb3626aa59c37 100644
(file)
--- 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);
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) {
if (fd < 0)
return -1;
while (size) {
diff --git
a/entry.c
b/entry.c
index 15b34eb6f9ac1db569487a3b732740f2d35831a7..410b758aab7efc6d777f0344500f97b1cbc52946 100644
(file)
--- 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;
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)
}
static int write_entry(struct cache_entry *ce, const char *path, struct checkout *state)