Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils: differentiate errors for write_file{,at} #325

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libcrun/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ write_file_at (int dirfd, const char *name, const void *data, size_t len, libcru
cleanup_close int fd = openat (dirfd, name, O_WRONLY | O_CREAT, 0700);
int ret = 0;
if (UNLIKELY (fd < 0))
return crun_make_error (err, errno, "writing file `%s`", name);
return crun_make_error (err, errno, "opening file `%s` for writing", name);

if (len)
{
Expand All @@ -213,7 +213,7 @@ write_file (const char *name, const void *data, size_t len, libcrun_error_t *err
cleanup_close int fd = open (name, O_WRONLY | O_CREAT, 0700);
int ret;
if (UNLIKELY (fd < 0))
return crun_make_error (err, errno, "writing file `%s`", name);
return crun_make_error (err, errno, "opening file `%s` for writing", name);

ret = TEMP_FAILURE_RETRY (write (fd, data, len));
if (UNLIKELY (ret < 0))
Expand Down