]> jfr.im git - irc/unrealircd/unrealircd.git/commitdiff
uname() vs uname #0001438
authoraquanight <redacted>
Sun, 17 Jun 2007 22:38:55 +0000 (22:38 +0000)
committeraquanight <redacted>
Sun, 17 Jun 2007 22:38:55 +0000 (22:38 +0000)
Changes
autoconf/configure.in
configure
include/setup.h.in
include/sys.h
src/ircd.c

diff --git a/Changes b/Changes
index d0caed308e66f1e2a386d5624a74a4271a34191a..276c6187bd8a3bc7a19b25b0a04957bd197b7be3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1788,3 +1788,11 @@ MOTDs
   though this probably means Debian will take us in, ick .. Can't we pull
   a new fight with debian-legal again?)
 - Made m_tkl use NULL instead of TOK_NONE
+- #0001438 reported by Mouse, to use uname() syscall on ircd start instead of
+  uname tool at Config/configure to fill in MYOSNAME. As with the #0003363 patch
+  this will make binary packages a bit more reasonable. As a side effect, the
+  amount of information in /version has been reduced to just the OS name (eg: Linux,
+  FreeBSD, etc) and release (2.6.17, 6.0-RELEASE, etc), which is about the same amount
+  of information given by Win32 IRCds. If for some reason uname() can't get this
+  info, we just config_warn and set MYOSNAME to "POSIX" as this data is only ever
+  used in /version.
index ed2cecaf70b27ec2845a55bf7f8a0c3d14c86326..5aa235bb958eb38fdfacf23a94fa2e11a52f0a0a 100644 (file)
@@ -367,7 +367,6 @@ AC_ARG_WITH(sendq, [AC_HELP_STRING([--with-sendq=maxsendq],[Specify the max send
 AC_DEFINE_UNQUOTED(MAXSENDQLENGTH,$withval),AC_DEFINE(MAXSENDQLENGTH,3000000))
 AC_ARG_WITH(bufferpool, [AC_HELP_STRING([--with-bufferpool=size],[Specify the size of the buffer pool])],
 AC_DEFINE_UNQUOTED(BUFFERPOOL,[($withval * MAXSENDQLENGTH)]),AC_DEFINE(BUFFERPOOL,[(18 * MAXSENDQLENGTH)]))
-AC_DEFINE_UNQUOTED(MYOSNAME,"`uname -a`")
 AC_ARG_WITH(permissions, [AC_HELP_STRING([--with-permissions=permissions],[Specify the default permissions for
 configuration files])], AC_DEFINE_UNQUOTED(DEFAULT_PERMISSIONS,$withval), AC_DEFINE(DEFAULT_PERMISSIONS, 0600)) 
 AC_ARG_WITH(dpath, [AC_HELP_STRING([--with-dpath=path],[Specify the path where configuration files are stored])],
index 520bc1df366ba494e47ea35f9e38a39689ef5f7f..b7c62fe9764293117f691a9c9ec5ac3b1c4dec63 100755 (executable)
--- a/configure
+++ b/configure
@@ -12359,10 +12359,6 @@ else
 _ACEOF
 
 fi;
-cat >>confdefs.h <<_ACEOF
-#define MYOSNAME "`uname -a`"
-_ACEOF
-
 
 # Check whether --with-permissions or --without-permissions was given.
 if test "${with_permissions+set}" = set; then
index 9f9837c9f110efe35445879685d08f1e4aa2329d..d70fe9a140e3e80eba57ad97db0b90423e0a6d4a 100644 (file)
 /* Define if you have crypt */
 #undef HAVE_CRYPT
 
-/* The OS name and version of the server */
-#undef MYOSNAME
-
 /* The default permissions for configuration files */
 #undef DEFAULT_PERMISSIONS
 
index 0994990a935ae7584945b2cfaab53bf81104707b..7566d148a9cc46730ff04e06ec22f67a5c314f60 100644 (file)
@@ -143,9 +143,9 @@ typedef unsigned long u_long;
 typedef unsigned int u_int;
 #endif
 
-#ifdef _WIN32
 #define MYOSNAME OSName
 extern char OSName[256];
+#ifdef _WIN32
 #define PATH_MAX MAX_PATH
 #endif
 #ifdef DEBUGMODE
index 1c03b9007e6ee323d4c3840b3c501829ffed2549..3748758cd6eda5de3a68554628509b8888ccceb8 100644 (file)
@@ -74,6 +74,9 @@ extern BOOL IsService;
 #ifdef USE_LIBCURL
 #include <curl/curl.h>
 #endif
+#ifndef _WIN32
+#include <sys/utsname.h>
+#endif
 ID_Copyright
     ("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
 ID_Notes("2.48 3/9/94");
@@ -1007,6 +1010,26 @@ static inline /* Only called in one place */ void generate_cloakkeys()
 }
 #endif
 
+#ifndef _WIN32
+char OSName[256]; /* Defined in win32/ stuff under _WIN32. */
+/* Fill in OSName from uname() */
+void GetOSName()
+{
+       struct utsname un;
+       int ret;
+       ret = uname(&un);
+       if (ret)
+       {
+               config_warn("Failed to get OSName: %s", strerror(errno));
+               strcpy(OSName, "POSIX");
+       }
+       else
+       {
+               snprintf(OSName, 256, "%s %s", un.sysname, un.release);
+       }
+}
+#endif
+
 #ifndef _WIN32
 int main(int argc, char *argv[])
 #else
@@ -1049,6 +1072,9 @@ int InitwIRCD(int argc, char *argv[])
        (void)signal(SIGUSR1, s_monitor);
 # endif
 #endif
+#ifndef _WIN32
+       GetOSName();
+#endif
 #ifdef CHROOTDIR
        if (chdir(dpath))
        {