Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#424) civserver --version as root
Home

[Freeciv-Dev] (PR#424) civserver --version as root

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: gkoopman@xxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#424) civserver --version as root
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Fri, 15 Nov 2002 12:58:18 -0800
Reply-to: rt@xxxxxxxxxxxxxx

Here's an update of this patch for current CVS.  No other changes have
been made.

Note that as I said in earlier replies, audio_init cannot be moved down
below where the options are parsed, as until we init the audio (modules)
we cannot determine which modules are available (which is needed for
--help).

Nonetheless, I think this is a pretty innocuous change, and is worth it
to fix the "bug".

jason

Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.152
diff -u -r1.152 civclient.c
--- client/civclient.c  2002/11/15 09:54:31     1.152
+++ client/civclient.c  2002/11/15 20:54:54
@@ -117,7 +117,6 @@
   char *option=NULL;
 
   init_nls();
-  dont_run_as_root(argv[0], "freeciv_client");
   audio_init();
 
   /* default argument values are set in options.c */
@@ -196,6 +195,9 @@
   /* Remove all options except those intended for the UI. */
   argv[1 + ui_options] = NULL;
   argc = 1 + ui_options;
+
+  /* disallow running as root -- too dangerous */
+  dont_run_as_root(argv[0], "freeciv_client");
 
   log_init(logfile, loglevel, NULL);
 
Index: server/civserver.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/civserver.c,v
retrieving revision 1.211
diff -u -r1.211 civserver.c
--- server/civserver.c  2002/11/14 09:15:04     1.211
+++ server/civserver.c  2002/11/15 20:54:55
@@ -56,9 +56,6 @@
   /* initialize server */
   srv_init();
 
-  /* disallow running as root -- too dangerous */
-  dont_run_as_root(argv[0], "freeciv_server");
-
   /* parse command-line arguments... */
 
 #ifdef GENERATING_MAC
@@ -149,6 +146,9 @@
     fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
     exit(EXIT_SUCCESS);
   }
+
+  /* disallow running as root -- too dangerous */
+  dont_run_as_root(argv[0], "freeciv_server");
 
   /* have arguments, call the main server loop... */
   srv_main();

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