Skip to content

Commit

Permalink
getpwuid: don't return uninitialized data on unexpected OS
Browse files Browse the repository at this point in the history
This commit makes it so the function doesn't compile on unexpected OSs
instead of returning uninitialized data.
  • Loading branch information
martinvonz committed Mar 9, 2024
1 parent fc836ef commit f98116b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/os/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ fn getpwuid(name: Name) -> Result<OsString> {
if result.is_null() {
return Err(super::err_null_record());
}
passwd.assume_init()
}

#[cfg(target_os = "illumos")]
Expand All @@ -278,9 +279,8 @@ fn getpwuid(name: Name) -> Result<OsString> {
if ret.is_null() {
return Err(Error::last_os_error());
}
passwd.assume_init()
}

passwd.assume_init()
};

// Extract names.
Expand Down

0 comments on commit f98116b

Please sign in to comment.