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

refactor: use NonNull to deal with pam_getenvlist #758

Merged
merged 1 commit into from
Sep 7, 2023
Merged

Conversation

japaric
Copy link
Collaborator

@japaric japaric commented Sep 7, 2023

I had trouble reading the original version and thought that the curr_str passed into CStr::from_ptr was not checked for null-ness but that was done in while condition -- the not very visible dereferencing operator there through me off.

The new version should hopefully make it clearer that a NonNull pointer is being passed into CStr::from_ptr. (Of course, it'd be even better if CStr::from_ptr signature was fn(NonNull<u8>) but we can't change the libstd API.) It also makes the dereferencing more explicit using the read method.

@japaric japaric added the minor minor issue, PR without an issue label Sep 7, 2023
@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@6d40763). Click here to learn what that means.
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #758   +/-   ##
=======================================
  Coverage        ?   55.04%           
=======================================
  Files           ?       71           
  Lines           ?     9765           
  Branches        ?        0           
=======================================
  Hits            ?     5375           
  Misses          ?     4390           
  Partials        ?        0           
Files Changed Coverage Δ
src/pam/mod.rs 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

Number of dependencies and binary size impact report

Metric main PR #758 Delta
Direct dependencies 3 3 -
Total dependencies 4 4 -
Binary size 1023.2 KiB 1023.5 KiB -
Text size 594.9 KiB 594.9 KiB -
Dependencies diff
 └─ sudo-rs [v0.2.0]
    ├─ glob [v0.3.1]
    ├─ libc [v0.2.147]
    └─ log [v0.4.20]

@pvdrz pvdrz added this pull request to the merge queue Sep 7, 2023
Merged via the queue into main with commit d077e90 Sep 7, 2023
16 checks passed
@japaric japaric deleted the getenvlist-nonnull branch September 15, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor minor issue, PR without an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants