Olof
Olof

Reputation: 797

Cannot import libc::funcs

I'm trying to change the UID of the running user. The documentation says that you should use libc::funcs::posix88::unistd::setuid.

When I try to compile, it prints an error:

Could not find `funcs` in `libc`

Upvotes: 0

Views: 469

Answers (1)

DK.
DK.

Reputation: 59065

First of all, it says that it's unstable, meaning you should avoid using it if at all possible. Unstable things can disappear or change at any time without warning. In particular, that's for the compiler-internal libc which you're not supposed to touch.

Secondly, that's from Rust 1.4, where the current version is 1.18. With the error you're getting, I assume you're using a different version of Rust to 1.4.

If you want to use libc, you should use the libc from the Cargo ecosystem. You can then find setuid in its API reference.

Upvotes: 1

Related Questions