-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-linuxOperating system: LinuxOperating system: LinuxT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
The following code panics:
unsafe { libc::clearenv(); };
assert_eq!(env::vars().count(), 0);
The problem is that env assumes that environ is not null. See Rust env implementation
The clearenv(3 ) function on linux is often implemented by freeing environ and setting it to null. See uclibc and glibc
In my opinion the stdlib could handle this more gracefully and return an empty iterator instead of panicking
sanmai-NL, JakubOnderka, mcarton, nagisa and ecarrara
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-linuxOperating system: LinuxOperating system: LinuxT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.