Welcome to little lamb

Code » limb » release » tree

[release] / src / liblimb / djbunix.h / open_b.c

/* This file is part of limb                           https://lila.oss/limb
 * Copyright (C) 2023 Olivier Brunel                          jjk@jjacky.com */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <limb/djbunix.h>

int
open_b(open_fn fn, const char *file)
{
    int fd = fn(file);
    if (fd < 0) return -1;
    if (ndelay_off(fd) < 0) {
        fd_close(fd);
        return -1;
    }
    return fd;
}