fileio: fix verification on failure in write_string_file_full()

Fixes a bug introduced by 0ab5e2a4b4.
This commit is contained in:
Yu Watanabe
2025-01-23 22:24:19 +09:00
parent eb86b4e63b
commit 9e096259ce
2 changed files with 1 additions and 4 deletions
+1 -1
View File
@@ -380,7 +380,7 @@ fail:
/* OK, the operation failed, but let's see if the right contents in place already. If so, eat up the
* error. */
if (verify_file(fn, line, !(flags & WRITE_STRING_FILE_AVOID_NEWLINE) || (flags & WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE)) > 0)
if (verify_file_at(dir_fd, fn, line, !(flags & WRITE_STRING_FILE_AVOID_NEWLINE) || (flags & WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE)) > 0)
return 0;
return r;
-3
View File
@@ -90,9 +90,6 @@ static inline int read_full_stream(FILE *f, char **ret_contents, size_t *ret_siz
}
int verify_file_at(int dir_fd, const char *fn, const char *blob, bool accept_extra_nl);
static inline int verify_file(const char *fn, const char *blob, bool accept_extra_nl) {
return verify_file_at(AT_FDCWD, fn, blob, accept_extra_nl);
}
int script_get_shebang_interpreter(const char *path, char **ret);