Skip to content

Instantly share code, notes, and snippets.

@ahihi
Last active October 18, 2015 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahihi/73419893bb2790cafa1a to your computer and use it in GitHub Desktop.
Save ahihi/73419893bb2790cafa1a to your computer and use it in GitHub Desktop.
diff --git a/configure.ac b/configure.ac
index 13d74ec..7e09feb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -292,11 +292,16 @@ AC_CHECK_DECL([forkpty],
#include <libutil.h>]])
AC_CHECK_LIB([util], [forkpty], [
- AC_DEFINE([HAVE_FORKPTY],, [Define if you have forkpty().])
+ AC_DEFINE([HAVE_FORKPTY], [1], [Define if you have forkpty().])
LIBUTIL="-lutil"
AC_SUBST([LIBUTIL])
])
+unset ac_cv_have_decl_forkpty
+AC_CHECK_DECL([forkpty],
+ [AC_DEFINE([HAVE_FORKPTY], [1], [Define if you have forkpty().])],
+ , [[#include <util.h>]])
+
AC_MSG_CHECKING([whether pipe2(..., O_CLOEXEC) is supported])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
#include <unistd.h>
diff --git a/src/frontend/mosh-client.cc b/src/frontend/mosh-client.cc
index 3523a71..ab454d6 100644
--- a/src/frontend/mosh-client.cc
+++ b/src/frontend/mosh-client.cc
@@ -155,10 +155,7 @@ int main( int argc, char *argv[] )
exit( 1 );
}
- if ( unsetenv( "MOSH_KEY" ) < 0 ) {
- perror( "unsetenv" );
- exit( 1 );
- }
+ unsetenv( "MOSH_KEY" );
/* Adopt native locale */
set_native_locale();
diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc
index 76ed2ed..bf421b3 100644
--- a/src/frontend/mosh-server.cc
+++ b/src/frontend/mosh-server.cc
@@ -472,10 +472,7 @@ static int run_server( const char *desired_ip, const char *desired_port,
}
/* clear STY environment variable so GNU screen regards us as top level */
- if ( unsetenv( "STY" ) < 0 ) {
- perror( "unsetenv" );
- exit( 1 );
- }
+ unsetenv( "STY" );
chdir_homedir();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment