Date: Sat, 20 Jun 2009 18:24:29 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r194548 - head/usr.bin/catman Message-ID: <200906201824.n5KIOTGV083394@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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':
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906201824.n5KIOTGV083394>