X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/checkpath/blobdiff_plain/879843463bdf570d8b1b4adf031b60e4ddf85f68..cfc8dd737dacc7b3ad394fa2d8649cf809a54bc8:/checkpath.c?ds=inline diff --git a/checkpath.c b/checkpath.c index 9c15086..12038dd 100644 --- a/checkpath.c +++ b/checkpath.c @@ -291,12 +291,12 @@ static unsigned sanity(const char *p, struct stat *st, if (S_ISDIR(st->st_mode) && (!(f & SF_LAST) || (cp->cp_what & CP_STICKYOK))) - stickyok = 01000; + stickyok = S_ISVTX; /* --- Check for world-writability --- */ if ((cp->cp_what & CP_WRWORLD) && - (st->st_mode & (0002 | stickyok)) == 0002) { + (st->st_mode & (S_IWOTH | stickyok)) == S_IWOTH) { bad |= CP_WRWORLD; report(cp, CP_WRWORLD, 1, p, "** world writable **"); } @@ -304,7 +304,7 @@ static unsigned sanity(const char *p, struct stat *st, /* --- Check for group-writability --- */ if ((cp->cp_what & (CP_WRGRP | CP_WROTHGRP)) && - (st->st_mode & (0020 | stickyok)) == 0020) { + (st->st_mode & (S_IWGRP | stickyok)) == S_IWGRP) { b = CP_WRGRP; if (cp->cp_what & CP_WROTHGRP) { @@ -464,7 +464,7 @@ unsigned checkpath(const char *p, const struct checkpath *cp) bad |= sanity(d.buf, &st, cp, ee ? 0 : SF_LAST); if (S_ISDIR(st.st_mode)) { - if (st.st_mode & 01000) + if (st.st_mode & S_ISVTX) sp->e_flags |= EF_STICKY; report(cp, CP_REPORT, 4, d.buf, "directory"); continue;