Skip to content

Commit

Permalink
FdSource: Fix operator =
Browse files Browse the repository at this point in the history
This wasn't moving the underlying buffer, so if the buffer was
non-empty, it could lose data.
  • Loading branch information
edolstra committed Jul 18, 2024
1 parent d231d80 commit fa7aa03
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/libutil/serialise.hh
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,7 @@ struct FdSource : BufferedSource
FdSource(Descriptor fd) : fd(fd) { }
FdSource(FdSource &&) = default;

FdSource & operator=(FdSource && s)
{
fd = s.fd;
s.fd = INVALID_DESCRIPTOR;
read = s.read;
return *this;
}
FdSource & operator=(FdSource && s) = default;

bool good() override;
protected:
Expand Down

0 comments on commit fa7aa03

Please sign in to comment.