forked from lix-project/lix
Fix segfault on i686-linux
https://hydra.nixos.org/build/107467517 Seems that on i686-linux, gcc and rustc disagree on how to return 1-word structs: gcc has the caller pass a pointer to the result, while rustc has the callee return the result in a register. Work around this by using a bare pointer.
This commit is contained in:
parent
dbc4f9d478
commit
949dc84894
|
@ -81,17 +81,4 @@ struct CBox
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Grrr, this is only needed because 'extern "C"' functions don't
|
|
||||||
// support non-POD return types (and CBox has a destructor so it's not
|
|
||||||
// POD).
|
|
||||||
template<typename T>
|
|
||||||
struct CBox2
|
|
||||||
{
|
|
||||||
T * ptr;
|
|
||||||
CBox<T> use()
|
|
||||||
{
|
|
||||||
return CBox(ptr);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
#include "compression.hh"
|
#include "compression.hh"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
rust::CBox2<rust::Result<std::tuple<>>> unpack_tarfile(rust::Source source, rust::StringSlice dest_dir);
|
rust::Result<std::tuple<>> *
|
||||||
|
unpack_tarfile(rust::Source source, rust::StringSlice dest_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
void unpackTarfile(Source & source, const Path & destDir)
|
void unpackTarfile(Source & source, const Path & destDir)
|
||||||
{
|
{
|
||||||
unpack_tarfile(source, destDir).use()->unwrap();
|
rust::Source source2(source);
|
||||||
|
rust::CBox(unpack_tarfile(source2, destDir))->unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void unpackTarfile(const Path & tarFile, const Path & destDir,
|
void unpackTarfile(const Path & tarFile, const Path & destDir,
|
||||||
|
|
Loading…
Reference in a new issue