From 3d8563ec9db357baf2e2670dc734a7115eca298b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 1 Apr 2019 20:04:48 +0100 Subject: [PATCH] uxpty.c: silence compiler warning about chdir(). I didn't check the error code, which for some reason didn't give me a -Werror warning on Ubuntu 18.04, but does on 16.04. --- unix/uxpty.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/uxpty.c b/unix/uxpty.c index d3b64b68..6b324e35 100644 --- a/unix/uxpty.c +++ b/unix/uxpty.c @@ -1145,8 +1145,12 @@ Backend *pty_backend_create( } } - if (dir) - chdir(dir); + if (dir) { + if (chdir(dir) < 0) { + /* Ignore the error - nothing we can sensibly do about it, + * and our existing cwd is as good a fallback as any. */ + } + } /* * SIGINT, SIGQUIT and SIGPIPE may have been set to ignored by