/* 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
fd_same(int fd1, int fd2)
{
    struct stat st1, st2;
    if (fstat(fd1, &st1) < 0 || fstat(fd2, &st2) < 0)
        return -1;
    return (st1.st_dev == st2.st_dev) && (st1.st_ino == st2.st_ino);
}