diff options
author | brane <brane@13f79535-47bb-0310-9956-ffa450edef68> | 2002-02-11 21:03:44 +0000 |
---|---|---|
committer | brane <brane@13f79535-47bb-0310-9956-ffa450edef68> | 2002-02-11 21:03:44 +0000 |
commit | c9f28341f7a0831f3a338c6ea13e0bdad3212548 (patch) | |
tree | 379b752a31cfe54bb812ab60bd00beac5c2899c9 /file_io/unix/filestat.c | |
parent | 33e2f2595bea66582184615dbc471ef562c549da (diff) | |
download | libapr-c9f28341f7a0831f3a338c6ea13e0bdad3212548.tar.gz |
apr_file_attrs_set takes a new parameter, attr_mask, that defines which
bits in the attributes are valid.
Changed Unix, OS/2 and Win32 implementation to match.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62943 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/unix/filestat.c')
-rw-r--r-- | file_io/unix/filestat.c | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/file_io/unix/filestat.c b/file_io/unix/filestat.c index 29bf16e50..d46640e40 100644 --- a/file_io/unix/filestat.c +++ b/file_io/unix/filestat.c @@ -138,6 +138,7 @@ APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, apr_fileattrs_t attributes, + apr_fileattrs_t attr_mask, apr_pool_t *cont) { apr_status_t status; @@ -147,21 +148,44 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, if (!APR_STATUS_IS_SUCCESS(status)) return status; - if (attributes & APR_FILE_ATTR_READONLY) { - finfo.protection &= ~APR_UWRITE; - finfo.protection &= ~APR_GWRITE; - finfo.protection &= ~APR_WWRITE; + /* ### TODO: should added bits be umask'd? */ + if (attr_mask & APR_FILE_ATTR_READONLY) + { + if (attributes & APR_FILE_ATTR_READONLY) + { + finfo.protection &= ~APR_UWRITE; + finfo.protection &= ~APR_GWRITE; + finfo.protection &= ~APR_WWRITE; + } + else + { + /* ### umask this! */ + finfo.protection |= APR_UWRITE; + finfo.protection |= APR_GWRITE; + finfo.protection |= APR_WWRITE; + } } - if (attributes & APR_FILE_ATTR_EXECUTABLE) { - /* ### TODO: should this be umask'd? */ - finfo.protection |= APR_UEXECUTE; - finfo.protection |= APR_GEXECUTE; - finfo.protection |= APR_WEXECUTE; + + if (attr_mask & APR_FILE_ATTR_EXECUTABLE) + { + if (attributes & APR_FILE_ATTR_EXECUTABLE) + { + /* ### umask this! */ + finfo.protection |= APR_UEXECUTE; + finfo.protection |= APR_GEXECUTE; + finfo.protection |= APR_WEXECUTE; + } + else + { + finfo.protection &= ~APR_UEXECUTE; + finfo.protection &= ~APR_GEXECUTE; + finfo.protection &= ~APR_WEXECUTE; + } } - return apr_file_perms_set(fname, finfo.protection); + return apr_file_perms_set(fname, finfo.protection); } - + APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, apr_int32_t wanted, apr_pool_t *cont) |