commit 2e22a7cd96554f2890a58a6abc884f057e79c2ca from: Stefan Sperling date: Thu Dec 27 18:19:03 2018 UTC remove redundant existence check commit - 515140783dfbb42d9deb4c8edd7d251d9cdf362c commit + 2e22a7cd96554f2890a58a6abc884f057e79c2ca blob - f6afe827f9a74a99f9dc08df62881efabab7310d blob + 7329316b310613cfdcacbc4879f7c0c512fd3aa4 --- lib/worktree.c +++ lib/worktree.c @@ -53,8 +53,6 @@ create_meta_file(const char *path_got, const char *nam const struct got_error *err = NULL; char *path; int fd = -1; - char buf[4]; - ssize_t n; if (asprintf(&path, "%s/%s", path_got, name) == -1) { err = got_error_from_errno(); @@ -66,14 +64,6 @@ create_meta_file(const char *path_got, const char *nam GOT_DEFAULT_FILE_MODE); if (fd == -1) { err = got_error_from_errno(); - goto done; - } - - /* The file should be empty. */ - n = read(fd, buf, sizeof(buf)); - if (n != 0) { - err = (n == -1 ? got_error_from_errno() : - got_error(GOT_ERR_WORKTREE_EXISTS)); goto done; }