client/src/unifycr.c
mode_t unifycr_getmode(mode_t perms)
{
    /* perms == 0 is shorthand for all read and write bits */
    if (perms == 0) {
        perms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
    }

    /* get current user mask */
    mode_t mask = umask(0);
    umask(mask);

    /* mask off bits from desired permissions */
    mode_t ret = perms & ~mask & 0777;
    return ret;
}
/* given an input mode, mask it with umask and return, can specify
 * an input mode==0 to specify all read/write bits */
given an input mode, mask it with umask and return, can specify
an input mode==0 to specify all read/write bits
given an input mode mask it with umask and return can specify an input mode == 0 to specify all read / write bits
mode_t unifycr_getmode(mode_t perms)
{
    if (perms == 0) {
        perms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
    }
    mode_t mask = umask(0);
    umask(mask);
    mode_t ret = perms & ~mask & 0777;
    return ret;
}
mode_t unifycr_getmode ( mode_t perms ) { if ( perms == 0 ) { perms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH ; } mode_t mask = umask ( 0 ) ; umask ( mask ) ; mode_t ret = perms & ~ mask & 0777 ; return ret ; }
given an input mode, mask it with umask and return, can specify
 an input mode==0 to specify all read/write bits
given an input mode mask it with umask and return can specify an input mode == 0 to specify all read / write bits
/* perms == 0 is shorthand for all read and write bits */ /* get current user mask */ /* mask off bits from desired permissions */