Skip to content
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
12 changes: 3 additions & 9 deletions lib/srv/uacc/uacc.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ static int uacc_add_utmp_entry(const char *utmp_path, const char *wtmp_path, con
return status;
}
updwtmp(wtmp_file, &entry);
if (errno != 0) {
return status_from_errno();
}
// updwtmp doesn't report errors, per the c standard we can't trust errno here.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

per the c standard

Are you sure this is specified in the C standard? That feels odd to me. Have a reference to the standard text?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf
Section 7.5.3: "The value of errno may be set to nonzero by a library function call whether or not there is an error, provided the use of errno is not documented in the description of the function in this document."

return 0;
}

Expand Down Expand Up @@ -197,9 +195,7 @@ static int uacc_mark_utmp_entry_dead(const char *utmp_path, const char *wtmp_pat
return status;
}
updwtmp(wtmp_file, &log_entry);
if (errno != 0) {
return status_from_errno();
}
// updwtmp doesn't report errors, per the c standard we can't trust errno here.
return 0;
}

Expand Down Expand Up @@ -267,9 +263,7 @@ static int uacc_add_btmp_entry(const char *btmp_path, const char *username,
memcpy(&entry.ut_addr_v6, remote_addr_v6, sizeof(int32_t) * 4);

updwtmp(file, &entry);
if (errno != 0) {
return status_from_errno();
}
// updwtmp doesn't report errors, per the c standard we can't trust errno here.
return 0;
}

Expand Down
Loading