/* 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_saread_closeat(stralloc *sa, int bfd, const char *file)
{
int fd = openb_readat(bfd, file);
if (fd < 0) return 0;
int r = sa_read(sa, fd);
fd_close(fd);
return r;
}