mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 17:05:49 +00:00
clar: Properly create file in helper
This commit is contained in:
parent
a12c291b54
commit
bbb3723657
@ -30,13 +30,12 @@ void cl_git_mkfile(const char *filename, const char *content)
|
|||||||
|
|
||||||
void cl_git_append2file(const char *filename, const char *new_content)
|
void cl_git_append2file(const char *filename, const char *new_content)
|
||||||
{
|
{
|
||||||
int fd = p_open(filename, O_WRONLY | O_APPEND | O_CREAT);
|
int fd = p_creat(filename, 0644);
|
||||||
cl_assert(fd != 0);
|
cl_assert(fd != 0);
|
||||||
if (!new_content)
|
if (!new_content)
|
||||||
new_content = "\n";
|
new_content = "\n";
|
||||||
cl_must_pass(p_write(fd, new_content, strlen(new_content)));
|
cl_must_pass(p_write(fd, new_content, strlen(new_content)));
|
||||||
cl_must_pass(p_close(fd));
|
cl_must_pass(p_close(fd));
|
||||||
cl_must_pass(p_chmod(filename, 0644));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *_cl_sandbox = NULL;
|
static const char *_cl_sandbox = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user