• R/O
  • SSH

posixpp: Commit

The main posixpp library and associated tests.


Commit MetaInfo

Revision9eb80934ba7d3ad70bd3c8d8b9df6de3813effde (tree)
Time2021-05-11 01:07:00
AuthorEric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

Fix 'move to self' bug.

Change Summary

Incremental Difference

diff -r b1efa70ccb74 -r 9eb80934ba7d pubincludes/posixpp/fd.h
--- a/pubincludes/posixpp/fd.h Mon May 10 09:02:35 2021 -0700
+++ b/pubincludes/posixpp/fd.h Mon May 10 09:07:00 2021 -0700
@@ -35,11 +35,12 @@
3535 //! looks valid, and it will ignore the return value.
3636 fd &operator =(fd &&other) noexcept {
3737 using ::syscalls::linux::close;
38+ int const tmpfd = other.fd_;
39+ other.fd_ = -1;
3840 if (fd_ >= 0) {
3941 close(fd_); // Ignore any error return.
4042 }
41- fd_ = other.fd_;
42- other.fd_ = -1;
43+ fd_ = tmpfd;
4344 return *this;
4445 }
4546
Show on old repository browser