Skip to content

Conversation

@deepakala-k
Copy link
Contributor

Enhanced error logging by including errno values in journal traces when file operations like open() fail. This provides more detailed diagnostics for debugging I/O issues.

Enhanced error logging by including errno values in journal traces
when file operations like open() fail. This provides more detailed
diagnostics for debugging I/O issues.

Signed-off-by: Deepa Karthikeyan <deepakala.karthikeyan@ibm.com>
free(path);
if (!cfam_id_file) {
pdbg_log(PDBG_ERROR, "Unable to open CFAM ID file\n");
pdbg_log(PDBG_ERROR, "Unable to open CFAM ID file errno: %d\n",errno);

Choose a reason for hiding this comment

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

After free() errno may have changed. It might be better to check before free() or save the errno.

}

PR_INFO("Unable to open %s\n", path);
PR_INFO("Unable to open %s, errno: %d \n", path, errno);

Choose a reason for hiding this comment

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

It is far away from open failure and error prone. Always better to have it close to failure or save the errno.

rc = sbefifo_connect(sbefifo_path, proc, &sf->sf_ctx);
if (rc) {
PR_ERROR("Unable to open sbefifo driver %s\n", sbefifo_path);
PR_ERROR("Unable to open sbefifo driver %s errno: %d\n", sbefifo_path, rc);

Choose a reason for hiding this comment

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

Do you want to print rc here as we don't know when errno was set in the sbefifo_connect(), right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants