mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Merge pull request #14283 from NixOS/nar-check
nix {cat,ls}: Add back missing checks for file descriptors
This commit is contained in:
commit
e34063cf21
2 changed files with 4 additions and 0 deletions
|
|
@ -76,6 +76,8 @@ struct CmdCatNar : StoreCommand, MixCat
|
|||
void run(ref<Store> store) override
|
||||
{
|
||||
AutoCloseFD fd = open(narPath.c_str(), O_RDONLY);
|
||||
if (!fd)
|
||||
throw SysError("opening NAR file '%s'", narPath);
|
||||
auto source = FdSource{fd.get()};
|
||||
auto narAccessor = makeNarAccessor(source);
|
||||
auto listing = listNar(narAccessor, CanonPath::root, true);
|
||||
|
|
|
|||
|
|
@ -146,6 +146,8 @@ struct CmdLsNar : Command, MixLs
|
|||
void run() override
|
||||
{
|
||||
AutoCloseFD fd = open(narPath.c_str(), O_RDONLY);
|
||||
if (!fd)
|
||||
throw SysError("opening NAR file '%s'", narPath);
|
||||
auto source = FdSource{fd.get()};
|
||||
auto narAccessor = makeNarAccessor(source);
|
||||
auto listing = listNar(narAccessor, CanonPath::root, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue