Author: brooks
Date: Sat Jun 20 18:24:29 2009
New Revision: 194548
URL: http://svn.freebsd.org/changeset/base/194548

Log:
  Restore the check against running as root that I accidentally removed in
  r194493.

Modified:
  head/usr.bin/catman/catman.c

Modified: head/usr.bin/catman/catman.c
==============================================================================
--- head/usr.bin/catman/catman.c        Sat Jun 20 18:24:25 2009        
(r194547)
+++ head/usr.bin/catman/catman.c        Sat Jun 20 18:24:29 2009        
(r194548)
@@ -91,6 +91,7 @@ static const char *locale_device[] = {
 #define        GZCAT_CMD       "z"
 enum Ziptype {NONE, BZIP, GZIP};
 
+static uid_t uid;
 static int starting_dir;
 static char tmp_file[MAXPATHLEN];
 struct stat test_st;
@@ -742,6 +743,14 @@ main(int argc, char **argv)
 {
        int opt;
 
+       if ((uid = getuid()) == 0) {
+               fprintf(stderr, "don't run %s as root, use:\n   echo", argv[0]);
+               for (optind = 0; optind < argc; optind++) {
+                       fprintf(stderr, " %s", argv[optind]);
+               }
+               fprintf(stderr, " | nice -5 su -m man\n");
+               exit(1);
+       }
        while ((opt = getopt(argc, argv, "vnfLrh")) != -1) {
                switch (opt) {
                case 'f':
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to