mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
parent
d5fdfdc592
commit
dc7615dbbb
3 changed files with 7 additions and 5 deletions
|
@ -581,7 +581,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
|
|
||||||
#if __linux__
|
#if __linux__
|
||||||
try {
|
try {
|
||||||
unshareFilesystem();
|
tryUnshareFilesystem();
|
||||||
} catch (nix::Error & e) {
|
} catch (nix::Error & e) {
|
||||||
e.addTrace({}, "in download thread");
|
e.addTrace({}, "in download thread");
|
||||||
throw;
|
throw;
|
||||||
|
|
|
@ -137,9 +137,9 @@ void restoreMountNamespace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unshareFilesystem()
|
void tryUnshareFilesystem()
|
||||||
{
|
{
|
||||||
if (unshare(CLONE_FS) != 0 && errno != EPERM)
|
if (unshare(CLONE_FS) != 0 && errno != EPERM && errno != ENOSYS)
|
||||||
throw SysError("unsharing filesystem state");
|
throw SysError("unsharing filesystem state");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,13 @@ void saveMountNamespace();
|
||||||
void restoreMountNamespace();
|
void restoreMountNamespace();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cause this thread to not share any FS attributes with the main
|
* Cause this thread to try to not share any FS attributes with the main
|
||||||
* thread, because this causes setns() in restoreMountNamespace() to
|
* thread, because this causes setns() in restoreMountNamespace() to
|
||||||
* fail.
|
* fail.
|
||||||
|
*
|
||||||
|
* This is best effort -- EPERM and ENOSYS failures are just ignored.
|
||||||
*/
|
*/
|
||||||
void unshareFilesystem();
|
void tryUnshareFilesystem();
|
||||||
|
|
||||||
bool userNamespacesSupported();
|
bool userNamespacesSupported();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue