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

Typo in "fnctl" / "fcntl" #30231

Closed
geofft opened this issue Dec 6, 2015 · 1 comment
Closed

Typo in "fnctl" / "fcntl" #30231

geofft opened this issue Dec 6, 2015 · 1 comment

Comments

@geofft
Copy link
Contributor

geofft commented Dec 6, 2015

I noticed that libstd/sys/unix/fd.rs has this code:

    #[cfg(target_env = "newlib")]
    pub fn set_cloexec(&self) {
        unsafe {
            let previous = libc::fnctl(self.fd, libc::F_GETFD);
            let ret = libc::fnctl(self.fd, libc::F_SETFD, previous | libc::FD_CLOEXEC);
            debug_assert_eq!(ret, 0);
        }
    }

I'm pretty sure that should be fcntl ("file control"), not fnctl: the call is consistent with the use of fcntl on other UNIXes, and as far as I can tell, the newlib git repo defines fcntl but not fnctl. This would need to be fixed in both libstd and liblibc.

But there's an explicit mention of this code in the PR introducing it (#29289), and I'm sort of surprised that this would link if it were misspelled, let alone work, so maybe I'm missing something? If this is correct, a comment would be nice. :)

cc @DiamondLovesYou

DiamondLovesYou added a commit to DiamondLovesYou/rust that referenced this issue Dec 8, 2015
@DiamondLovesYou
Copy link
Contributor

You're right, oops (PNaCl isn't testable yet within Rust proper, so I didn't catch it!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants