Forums: Index > Development > Running as superuser?

I've been compiling Freeciv on Haiku in the last days, first problem I came up with was that I had to disable cflags optimization for the sdl-client -O0 instead of -O2 to be able to build the client, secondly some missing brackets (not that hard) but after things compiled and I tried to run the client I get: ~> /boot/apps/Freeciv/bin/civclient /boot/apps/Freeciv/bin/civclient: Fatal error: you're trying to run me as superuser! Use a non-privileged account instead. Anyone seen this problem before?


Kernigh writes: I never have this problem. My OpenBSD system is a Unix clone, so superuser is the 'root' user account. I log in as 'kernigh', who is not 'root', so I can run civclient. I guess that Haiku is not a Unix clone, so you need to delete the superuser check in the source code.

If you have Freeciv 2.1.9, the superuser check is 'dont_run_as_root' in freeciv-2.1.9/utility/shared.c:

  If we have root privileges, die with an error.
  (Eg, for security reasons.)
  Param argv0 should be argv[0] or similar; fallback is
  used instead if argv0 is NULL.
  But don't die on systems where the user is always root...
  (a general test for this would be better).
  Doesn't use freelog() because gets called before logging is setup.
void dont_run_as_root(const char *argv0, const char *fallback)
#if (defined(ALWAYS_ROOT) || defined(__EMX__) || defined(__BEOS__))
  if (getuid()==0 || geteuid()==0) {
               _("%s: Fatal error: you're trying to run me as superuser!\n"),
               (argv0 ? argv0 : fallback ? fallback : "freeciv"));
    fc_fprintf(stderr, _("Use a non-privileged account instead.\n"));

I guess that you need to add -DALWAYS_ROOT to your CPPFLAGS, or alternatively, you need to add defined(__???__) to this source code, replacing the __???__ with the definition for Haiku. --Kernigh 22:49, November 9, 2009 (UTC)

Community content is available under CC-BY-SA unless otherwise noted.