示例#1
0
文件: filesys.c 项目: ctubio/alpine
int
our_chmod(char *path, mode_t mode)
{
#ifdef _WINDOWS
    LPTSTR p = NULL;
    int    ret = -1;

    p = utf8_to_lptstr((LPSTR) path);
    if(p){
	ret = _tchmod(p, mode);
	fs_give((void **) &p);
    }

    return ret;
#else /* UNIX */
    return(chmod(fname_to_locale(path), mode));
#endif /* UNIX */
}
示例#2
0
static void check_csync_vio_opendir_perm(void **state)
{
    CSYNC *csync = *state;
    csync_vio_handle_t *dh;
    int rc;
    mbchar_t *dir = c_utf8_path_to_locale(CSYNC_TEST_DIR);

    assert_non_null(dir);

    rc = _tmkdir(dir, (S_IWUSR|S_IXUSR));
    assert_int_equal(rc, 0);

    dh = csync_vio_opendir(csync, CSYNC_TEST_DIR);
    assert_null(dh);
    assert_int_equal(errno, EACCES);

    _tchmod(dir, MKDIR_MASK);
    c_free_locale_string(dir);
}
示例#3
0
// Return the file attributes for file f or 0 if failure. f :: File path.
// int getfileattr(char *f) { struct stat s; return SSTAT(f, &
//   s) == 0 ? s.st_mode : 0; }
// Give the file f the attributes a, return non-zero on failure. f :: file
//   path. a :: attributes returned by getfileattr().
int setfileattr(const DZStrW &f, int a)
{
	return _tchmod(f.c_str(), a);
}