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>
This commit is contained in:
parent
7f272ca80c
commit
781411ed46
2
apply.c
2
apply.c
@ -1588,7 +1588,7 @@ static int try_create_file(const char *path, unsigned int mode, const char *buf,
|
|||||||
|
|
||||||
if (S_ISLNK(mode))
|
if (S_ISLNK(mode))
|
||||||
return symlink(buf, path);
|
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)
|
if (fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
while (size) {
|
while (size) {
|
||||||
|
2
entry.c
2
entry.c
@ -60,7 +60,7 @@ static void remove_subtree(const char *path)
|
|||||||
static int create_file(const char *path, unsigned int mode)
|
static int create_file(const char *path, unsigned int mode)
|
||||||
{
|
{
|
||||||
mode = (mode & 0100) ? 0777 : 0666;
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user