diff --git a/configure.ac b/configure.ac index 3e9cbc84..96a2faca 100644 --- a/configure.ac +++ b/configure.ac @@ -82,7 +82,6 @@ dnl --------------------------------------------------------------------- AC_CHECK_FUNC([getline],, AC_MSG_ERROR("Could not find getline in c library")) AC_CHECK_FUNC([open],, AC_MSG_ERROR("Could not find open in c library")) AC_CHECK_FUNC([sysconf],, AC_MSG_ERROR("Could not find sysconf")) -AC_CHECK_FUNC([getenv],, AC_MSG_ERROR("Could not find getenv")) AC_CHECK_FUNC([strtok_r],, AC_MSG_ERROR("Could not find strtok_r")) AC_CHECK_FUNC([flock],, AC_MSG_ERROR("Could not find flock")) AC_CHECK_FUNC([ftruncate],,AC_MSG_ERROR("Could not find ftruncate")) @@ -91,7 +90,8 @@ AC_CHECK_FUNC([setlocale],,AC_MSG_ERROR("Could not find setlocale")) AC_CHECK_FUNC([atexit],, AC_MSG_ERROR("Could not find atexit in c library")) AC_CHECK_HEADER([math.h],, AC_MSG_ERROR("Could not find math.h header file")) -AC_SEARCH_LIBS([asin],[m],, AC_MSG_ERROR("Could not find asin in math library")) +AC_SEARCH_LIBS([floor],[m],, AC_MSG_ERROR("Could not find floor in math library")) +AC_SEARCH_LIBS([ceil], [m],, AC_MSG_ERROR("Could not find ceil in math library")) dnl --------------------------------------------------------------------- dnl Check dependencies diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index c0ba2f8c..31a19f7e 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -138,7 +138,7 @@ static void delete_ssh ( const char *host ) */ static char **read_known_hosts_file ( char ** retv, unsigned int *length ) { - char *path = g_build_filename ( g_getenv ( "HOME" ), ".ssh", "known_hosts", NULL ); + char *path = g_build_filename ( g_get_home_dir (), ".ssh", "known_hosts", NULL ); FILE *fd = fopen ( path, "r" ); if ( fd != NULL ) { char *buffer = NULL; @@ -267,7 +267,7 @@ static char ** get_ssh ( unsigned int *length ) unsigned int num_favorites = 0; char *path; - if ( getenv ( "HOME" ) == NULL ) { + if ( g_get_home_dir () == NULL ) { return NULL; } @@ -284,7 +284,7 @@ static char ** get_ssh ( unsigned int *length ) } FILE *fd = NULL; - const char *hd = getenv ( "HOME" ); + const char *hd = g_get_home_dir (); path = g_build_filename ( hd, ".ssh", "config", NULL ); fd = fopen ( path, "r" ); diff --git a/source/rofi.c b/source/rofi.c index 5b4fa79a..c753f488 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -830,15 +830,16 @@ int main ( int argc, char *argv[] ) atexit ( cleanup ); TICK (); - // Get DISPLAY, first env, then argument. - char *display_str = getenv ( "DISPLAY" ); - find_arg_str ( "-display", &display_str ); - if ( setlocale ( LC_ALL, "" ) == NULL ) { fprintf ( stderr, "Failed to set locale.\n" ); return EXIT_FAILURE; } + // Get DISPLAY, first env, then argument. + // We never modify display_str content. + char *display_str = ( char *)g_getenv ( "DISPLAY" ); + find_arg_str ( "-display", &display_str ); + xcb->connection = xcb_connect ( display_str, &xcb->screen_nbr ); if ( xcb_connection_has_error ( xcb->connection ) ) { fprintf ( stderr, "Failed to open display: %s", display_str );