Version: 1.3.8 (using KDE KDE 3.2.0) Installed from: Compiled From Sources Compiler: gcc (GCC) 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk) OS: Linux ksysv crashes immediately after starting with signal 11. The crash is caused by the fact that the hostname returned by gethostname is not found by gethostbyname in /etc/hosts. My hostname set on linux boot time is "linux", my /etc/hosts looks like: 192.168.1.1 my_router 127.0.0.1 localhost This makes ksysv crash in ksv_core.cpp at line #106: 102 if (!gethostname (buffer, BUFFER_LEN)) 103 { 104 hostent* info = gethostbyname (buffer); 105 106 hostname = info->h_name; 107 } 108 else 109 { 110 hostname = i18n("Unknown Host"); 110 } gethostname returns "linux" in buffer, but gethostbyname returns a zero pointer so that access to info caises signal 11 crash.
Added hostname to /etc/hosts and problem was resolved. Believe this to confirm circumvention.
*** Bug 86356 has been marked as a duplicate of this bug. ***
*** Bug 37123 has been marked as a duplicate of this bug. ***
SVN commit 544103 by mueller: fix crash on startup BUG: 81927 M +2 -1 TopWidget.cpp M +0 -29 ksv_core.cpp M +0 -5 ksv_core.h --- branches/KDE/3.5/kdeadmin/ksysv/TopWidget.cpp #544102:544103 @@ -51,6 +51,7 @@ #include <qwhatsthis.h> #include <qsimplerichtext.h> +#include <kresolver.h> #include <ktoolbar.h> #include <kkeydialog.h> #include <kmenubar.h> @@ -953,7 +954,7 @@ void KSVTopLevel::setCaption (bool changed) { - setPlainCaption (kapp->makeStdCaption(ksv::hostname(), true, changed)); + setPlainCaption (kapp->makeStdCaption(KNetwork::KResolver::localHostName(), true, changed)); } KActionCollection* KSVTopLevel::filteredActions () --- branches/KDE/3.5/kdeadmin/ksysv/ksv_core.cpp #544102:544103 @@ -12,10 +12,6 @@ * * ***************************************************************************/ -#include <ctype.h> -#include <unistd.h> -#include <netdb.h> - #include <qpushbutton.h> #include <qstylesheet.h> @@ -89,31 +85,6 @@ return c; } -QString ksv::hostname () -{ -#ifndef BUFFER_LEN -#define BUFFER_LEN 255 -#endif - char buffer[BUFFER_LEN]; - QString hostname; - - if (!gethostname (buffer, BUFFER_LEN)) - { - hostent* info = gethostbyname (buffer); - - hostname = info->h_name; - } - else - { - hostname = i18n("Unknown Host"); - } -#ifdef BUFFER_LEN -#undef BUFFER_LEN -#endif - - return hostname; -} - QStyleSheet* ksv::styleSheet () { static QStyleSheet style; --- branches/KDE/3.5/kdeadmin/ksysv/ksv_core.h #544102:544103 @@ -32,11 +32,6 @@ */ const QString& copyrightSymbol (); - /** - * \return the hostname (or "Unknown Host") - */ - QString hostname (); - QStyleSheet* styleSheet (); const QString& logFileFilter ();