mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
nix {cat,ls}: Add back missing checks for file descriptors
I didn't catch this during the review of https://github.com/NixOS/nix/pull/14273. This fixes that mistake.
This commit is contained in:
parent
64c55961eb
commit
e457ea7688
2 changed files with 4 additions and 0 deletions
|
|
@ -76,6 +76,8 @@ struct CmdCatNar : StoreCommand, MixCat
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
AutoCloseFD fd = open(narPath.c_str(), O_RDONLY);
|
AutoCloseFD fd = open(narPath.c_str(), O_RDONLY);
|
||||||
|
if (!fd)
|
||||||
|
throw SysError("opening NAR file '%s'", narPath);
|
||||||
auto source = FdSource{fd.get()};
|
auto source = FdSource{fd.get()};
|
||||||
auto narAccessor = makeNarAccessor(source);
|
auto narAccessor = makeNarAccessor(source);
|
||||||
auto listing = listNar(narAccessor, CanonPath::root, true);
|
auto listing = listNar(narAccessor, CanonPath::root, true);
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,8 @@ struct CmdLsNar : Command, MixLs
|
||||||
void run() override
|
void run() override
|
||||||
{
|
{
|
||||||
AutoCloseFD fd = open(narPath.c_str(), O_RDONLY);
|
AutoCloseFD fd = open(narPath.c_str(), O_RDONLY);
|
||||||
|
if (!fd)
|
||||||
|
throw SysError("opening NAR file '%s'", narPath);
|
||||||
auto source = FdSource{fd.get()};
|
auto source = FdSource{fd.get()};
|
||||||
auto narAccessor = makeNarAccessor(source);
|
auto narAccessor = makeNarAccessor(source);
|
||||||
auto listing = listNar(narAccessor, CanonPath::root, true);
|
auto listing = listNar(narAccessor, CanonPath::root, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue