diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-12-18 21:48:57 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-12-19 00:02:49 +0100 |
commit | 0c5028faea7e5c08c920f8ea31f02e7923b8c2d8 (patch) | |
tree | eb48ffdc6c937bed19a81091dcd5d4cfad1e86b8 /nix/sync-with-upstream | |
parent | 37dd969c2eff527e21e2d277b3f4433111a0ca9e (diff) | |
download | guix-0c5028faea7e5c08c920f8ea31f02e7923b8c2d8.tar.gz |
daemon: Fix 'HashSink::currentHash()'.
Before that, calls to 'HashSink::currentHash()' would eventually lead to a segfault because the underlying gcrypt handle has been closed. (Note that this method is only used via 'importPaths' and 'exportPath', though.) * nix/libutil/gcrypt-hash.hh (struct guix_hash_context): Add a constructor and a copy constructor; move out of 'extern "C"'. * nix/libutil/gcrypt-hash.cc (guix_hash_final): Clear 'md_handle' upon exit. * nix/sync-with-upstream (top_srcdir): Change hash.{cc,hh} to read 'struct Ctx' instead of 'union Ctx'.
Diffstat (limited to 'nix/sync-with-upstream')
-rwxr-xr-x | nix/sync-with-upstream | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nix/sync-with-upstream b/nix/sync-with-upstream index 535763d602..bb3a68b917 100755 --- a/nix/sync-with-upstream +++ b/nix/sync-with-upstream @@ -70,3 +70,11 @@ cp -v "$top_srcdir/nix-upstream/AUTHORS" "$top_srcdir/nix" # Substitutions. sed -i "$top_srcdir/nix/libstore/gc.cc" \ -e 's|/nix/find-runtime-roots\.pl|/guix/list-runtime-roots|g' + +# Our 'guix_hash_context' structure has a copy constructor, specifically to +# handle the use case in 'HashSink::currentHash()' where the copy of the +# context is expected to truly copy the underlying hash context. The copy +# constructor cannot be used in 'Ctx' if that's a union, so turn it into a +# structure (we can afford to two wasted words.) +sed -i "$top_srcdir/nix/libutil/hash".{cc,hh} \ + -e 's|union Ctx|struct Ctx|g' |