Skip to content

cfgetospeed(): called Result::unwrap() on an Err value: EINVAL #2672

@julian-klode

Description

@julian-klode

Given

use nix::sys::termios::{
    cfgetospeed, tcgetattr
};

fn main() {
    let stdin = std::io::stdin();
    let termios = tcgetattr(stdin).expect("Could not get terminal attributes");
    let speed = cfgetospeed(&termios);
    println!("{:?}", speed);
}

We receive:

> cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/demo`

thread 'main' panicked at /home/jak/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nix-0.30.1/src/sys/termios.rs:767:70:
called `Result::unwrap()` on an `Err` value: EINVAL
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

with glibc 2.42

(Minimized reproducer of uutils/coreutils#8474)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions