diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-06-10 13:30:09 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-06-10 13:30:09 +0200 |
commit | 829af22759b8a99c3b44697365390a945f3acc04 (patch) | |
tree | 0968e63ada2198f354621101b0cf3c6b79684d6c /src/libutil/serialise.hh | |
parent | 3c6b8a521561f5341652ffe37b869d5ab457227b (diff) |
Print a warning when loading a large path into memory
I.e. if you have a derivation with
src = ./huge-directory;
you'll get a warning that this is not a good idea.
Diffstat (limited to 'src/libutil/serialise.hh')
-rw-r--r-- | src/libutil/serialise.hh | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh index e5a9df1d0..3d296cf6d 100644 --- a/src/libutil/serialise.hh +++ b/src/libutil/serialise.hh @@ -72,6 +72,8 @@ struct BufferedSource : Source struct FdSink : BufferedSink { int fd; + bool warn; + size_t written; FdSink() : fd(-1) { } FdSink(int fd) : fd(fd) { } @@ -95,10 +97,7 @@ struct FdSource : BufferedSource struct StringSink : Sink { string s; - void operator () (const unsigned char * data, size_t len) - { - s.append((const char *) data, len); - } + void operator () (const unsigned char * data, size_t len); }; |