Skip to content

Commit

Permalink
unshareFilesystem: Do not assume caller
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed May 22, 2024
1 parent bd7a074 commit d5fdfdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/libstore/filetransfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,12 @@ struct curlFileTransfer : public FileTransfer
#endif

#if __linux__
unshareFilesystem();
try {
unshareFilesystem();
} catch (nix::Error & e) {
e.addTrace({}, "in download thread");
throw;
}
#endif

std::map<CURL *, std::shared_ptr<TransferItem>> items;
Expand Down
2 changes: 1 addition & 1 deletion src/libutil/linux/namespaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void restoreMountNamespace()
void unshareFilesystem()
{
if (unshare(CLONE_FS) != 0 && errno != EPERM)
throw SysError("unsharing filesystem state in download thread");
throw SysError("unsharing filesystem state");
}

}

0 comments on commit d5fdfdc

Please sign in to comment.