Skip to content

Commit

Permalink
Merge pull request #1513 from NilsIrl/patch-1
Browse files Browse the repository at this point in the history
Use write_file_at_with_flags in write_file_with_flags
  • Loading branch information
giuseppe authored Aug 9, 2024
2 parents e623b93 + 3bcd26a commit f5912d1
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/libcrun/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,7 @@ write_file_at (int dirfd, const char *name, const void *data, size_t len, libcru
int
write_file_with_flags (const char *name, int flags, const void *data, size_t len, libcrun_error_t *err)
{
cleanup_close int fd = open (name, O_CLOEXEC | O_WRONLY | flags, 0700);
int ret;
if (UNLIKELY (fd < 0))
return crun_make_error (err, errno, "opening file `%s` for writing", name);

ret = TEMP_FAILURE_RETRY (write (fd, data, len));
if (UNLIKELY (ret < 0))
return crun_make_error (err, errno, "writing file `%s`", name);

return ret;
return write_file_at_with_flags (AT_FDCWD, flags, 0700, name, data, len, err);
}

int
Expand Down

0 comments on commit f5912d1

Please sign in to comment.