Merge pull request #150 from ttohin/feature/osx-build

Fix osx build
This commit is contained in:
Filippo Scognamiglio 2014-10-09 22:20:44 +02:00
commit 1cbedb41d9
3 changed files with 19 additions and 1 deletions

5
.gitignore vendored
View File

@ -42,3 +42,8 @@ Makefile*
# Excludes compiled files
imports
cool-retro-term
# Mac OSX
.DS_Store
*.app

View File

@ -6,7 +6,10 @@ TEMPLATE = lib
CONFIG += qt plugin hide_symbols
QT += qml quick widgets
DEFINES += HAVE_POSIX_OPENPT HAVE_SYS_TIME_H HAVE_UPDWTMPX
DEFINES += HAVE_POSIX_OPENPT HAVE_SYS_TIME_H
!macx:DEFINES += HAVE_UPDWTMPX
macx:DEFINES += HAVE_UTMPX HAVE_UT_USER
#MANUALY DEFINED PLATFORM
DEFINES += Q_WS_UBUNTU

View File

@ -506,7 +506,11 @@ void KPty::login(const char * user, const char * remotehost)
// note: strncpy without terminators _is_ correct here. man 4 utmp
if (user) {
# ifdef HAVE_UT_USER
strncpy(l_struct.ut_user, user, sizeof(l_struct.ut_user));
#elif
strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name));
#endif
}
if (remotehost) {
@ -617,7 +621,13 @@ void KPty::logout()
setutent();
if ((ut = getutline(&l_struct))) {
# endif
# ifdef HAVE_UT_USER
memset(ut->ut_user, 0, sizeof(*ut->ut_user));
#elif
memset(ut->ut_name, 0, sizeof(*ut->ut_name));
#endif
memset(ut->ut_host, 0, sizeof(*ut->ut_host));
# ifdef HAVE_STRUCT_UTMP_UT_SYSLEN
ut->ut_syslen = 0;