summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2009-07-06 01:32:29 +0000
committerBrooks Davis <brooks@FreeBSD.org>2009-07-06 01:32:29 +0000
commit37b00d3569f47ba40551ea4c14eed9234abb7146 (patch)
treedfaa5e9cc90087bcdf68de8bb3347cd01c5f922f /usr.bin
parentd6c26430f0507d4bbc93cc40e537556cdb3e66cf (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/catman/catman.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/usr.bin/catman/catman.c b/usr.bin/catman/catman.c
index ced6ae6bbc55..ba3ad248a2c2 100644
--- a/usr.bin/catman/catman.c
+++ b/usr.bin/catman/catman.c
@@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$");
#define TEST_FILE 0x04
#define TEST_READABLE 0x08
#define TEST_WRITABLE 0x10
-#define TEST_EXECUTABLE 0x20
static int verbose; /* -v flag: be verbose with warnings */
static int pretend; /* -n, -p flags: print out what would be done
@@ -93,8 +92,6 @@ static const char *locale_device[] = {
enum Ziptype {NONE, BZIP, GZIP};
static uid_t uid;
-static gid_t gids[NGROUPS_MAX];
-static int ngids;
static int starting_dir;
static char tmp_file[MAXPATHLEN];
struct stat test_st;
@@ -320,23 +317,10 @@ test_path(char *name, time_t *mod_time)
result |= TEST_DIR;
else if (S_ISREG(test_st.st_mode))
result |= TEST_FILE;
- if (test_st.st_uid == uid) {
- test_st.st_mode >>= 6;
- } else {
- int i;
- for (i = 0; i < ngids; i++) {
- if (test_st.st_gid == gids[i]) {
- test_st.st_mode >>= 3;
- break;
- }
- }
- }
- if (test_st.st_mode & S_IROTH)
+ if (access(name, R_OK))
result |= TEST_READABLE;
- if (test_st.st_mode & S_IWOTH)
+ if (access(name, W_OK))
result |= TEST_WRITABLE;
- if (test_st.st_mode & S_IXOTH)
- result |= TEST_EXECUTABLE;
return result;
}
@@ -789,7 +773,6 @@ main(int argc, char **argv)
/* NOTREACHED */
}
}
- ngids = getgroups(NGROUPS_MAX, gids);
if ((starting_dir = open(".", 0)) < 0) {
err(1, ".");
}