X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=apply.c;h=c471a82e83691b152c2b80ea25310afef9b0db95;hb=8e76c79f4a1e66ed8e371d1232e879f45141dce1;hp=d5e7bfdb4de1fe7990ae11e190537fd1c490d54c;hpb=c2f3bf071ee90b01f2d629921bb04c4f798f02fa;p=git.git diff --git a/apply.c b/apply.c index d5e7bfdb..c471a82e 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) { @@ -1635,7 +1635,8 @@ static void create_one_file(const char *path, unsigned mode, const char *buf, un } if (errno != EEXIST) break; - } + ++nr; + } } die("unable to write file %s mode %o", path, mode); }