Commit d01db3c9 authored by Oliver Giles's avatar Oliver Giles

unix-abstract test: chdir back and catch syscall errors

parent 03441d57
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#else #else
#include <netdb.h> #include <netdb.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h>
#endif #endif
namespace kj { namespace kj {
...@@ -400,7 +401,12 @@ TEST(AsyncIo, AbstractUnixSocket) { ...@@ -400,7 +401,12 @@ TEST(AsyncIo, AbstractUnixSocket) {
Own<ConnectionReceiver> listener = addr->listen(); Own<ConnectionReceiver> listener = addr->listen();
// chdir proves no filesystem dependence. Test fails for regular unix socket // chdir proves no filesystem dependence. Test fails for regular unix socket
// but passes for abstract unix socket. // but passes for abstract unix socket.
chdir("/tmp"); int originalDirFd;
KJ_SYSCALL(originalDirFd = open(".", O_RDONLY | O_DIRECTORY | O_CLOEXEC));
KJ_DEFER(close(originalDirFd));
KJ_SYSCALL(chdir("/tmp"));
KJ_DEFER(KJ_SYSCALL(fchdir(originalDirFd)));
addr->connect().attach(kj::mv(listener)).wait(ioContext.waitScope); addr->connect().attach(kj::mv(listener)).wait(ioContext.waitScope);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment