#include <fcntl.h>
#include <print>

int main()
{
    int fd = open("/etc/passwd", O_WRONLY);
    if (fd == -1) {
        int saved_errno = errno;                       // <-- **IMPORTANT**
        std::println("open failed");
        std::println("errno=={}", saved_errno);        // <-- explicity printing the *correct* errno
        return 1;
    }

    return 0;
}
