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

bindings: better logging for write_string() #250

Merged
merged 1 commit into from Jul 30, 2018

Conversation

brauner
Copy link
Member

@brauner brauner commented Jul 30, 2018

Closes #249.

Signed-off-by: Christian Brauner christian.brauner@ubuntu.com

@brauner brauner force-pushed the 2018-07-30/improve_error_message branch from 83e224f to 10f9497 Compare July 30, 2018 08:55
@tomponline
Copy link
Contributor

thanks! @brauner

bindings.c Outdated
len = strlen(string);
ret = fwrite(string, 1, len, f);
if (ret != len) {
lxcfs_error("Error writing to file: %s\n", strerror(errno));
lxcfs_error("%s - Error writing \"%s\" to \"%s\"\n",
strerror(errno), string ? string : "(null)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think string can be NULL here? Otherwise the strlen(string) and fwrite(string, ...) would already be an issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Closes lxc#249.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
@brauner brauner force-pushed the 2018-07-30/improve_error_message branch from 10f9497 to beb5024 Compare July 30, 2018 20:14
@stgraber stgraber merged commit bca3213 into lxc:master Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants