Add misc safe rules - #264
Merged
Merged
Conversation
This reverts commit 1d6add1. Useful for macos where the fields have different types than the ones declared in our shim.
nunoplopes
reviewed
Jul 17, 2026
| fn f1(a0: u32) -> Ptr<Passwd> { | ||
| match nix::unistd::User::from_uid(nix::unistd::Uid::from_raw(a0)) { | ||
| Ok(Some(__u)) => Ptr::alloc(Passwd::from_user(&__u)), | ||
| _ => Ptr::null(), |
nunoplopes
reviewed
Jul 17, 2026
| use libcc2rs::*; | ||
|
|
||
| fn f1(a0: i32, a1: Ptr<u8>) -> Ptr<u8> { | ||
| Ptr::from_string_literal(b"C") |
Contributor
There was a problem hiding this comment.
this is not correct for sure :)
Contributor
Author
There was a problem hiding this comment.
Rust does not seem to have support for localization
The man page of setlocale says:
A successful call to setlocale() returns an opaque string that
corresponds to the locale set. This string may be allocated in
static storage. The string returned is such that a subsequent
call with that string and its associated category will restore
that part of the process's locale. The return value is NULL if
the request cannot be honored.
So the real options here are to return C (The locale "C" or "POSIX" is a portable locale; it exists on all conforming systems.) or NULL. NULL looks more like a failure, so I chose "C" instead.
Contributor
There was a problem hiding this comment.
We probably need to track the locale ourselves and change the behavior of relevant string functions then
Contributor
Author
There was a problem hiding this comment.
I added a TODO about that
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.