Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
Re: [Freeciv-Dev] Another OS/2 issue

Re: [Freeciv-Dev] Another OS/2 issue

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Alexander Mai <st002279@xxxxxxxxxxxxxxxxxxxxxx>
Cc: "freeciv-dev@xxxxxxxxxxx" <freeciv-dev@xxxxxxxxxxx>
Subject: Re: [Freeciv-Dev] Another OS/2 issue
From: Greg Wooledge <wooledge@xxxxxxxxxxx>
Date: Mon, 26 Jul 1999 23:04:07 -0400

Alexander Mai (st002279@xxxxxxxxxxxxxxxxxxxxxx) wrote:

> First an addition to the sys/select.h stuff:
> given the configure patch one may adjust the lines in
> sernet.c, civserver.c and mapview.c, too.
> It seems to affect AIX, too. Another fine IBM product ;-)

I've been running the civserver on AIX (4.3.2) without any problems.

> +#ifndef __EMX__
>    if (!getuid() || !geteuid()) {
>      fprintf(stderr, "%s: Fatal error: you're trying to run me as 
> superuser!\n",
>           (argv[0] ? argv[0] : "freeciv_server"));

Embedding names of platforms and development environments is not the
"Right Way" to do it -- it's what autoconf is designed to avoid.

However, as I understand it, a lot of the compilers for single-user
operating systems have getuid() and related calls for Unix compatibility,
but these calls always return 0 (or some such behavior).  Thus, a simple
autoconf check for getuid() will fail to detect that this platform's
implementation is a merely a stub.

(If you check that getuid() returns a non-zero value, then compilation
of freeciv as root on a Unix-like box will give undesirable behavior
in the resulting executable.  A lot of newbie Linux users compile/run
everything as root, so ironically the exact scenario that the above code
is trying to avoid would be aggravated.)

Does anyone know of a good way to determine (at ./configure time) whether
one is on a multi-user or single-user operating system?

Greg Wooledge                    | Distributed.NET
wooledge@xxxxxxxxxxx             | because a CPU is a terrible thing to waste. |

[Prev in Thread] Current Thread [Next in Thread]