diff options
author | Graham Leggett <minfrin@apache.org> | 2010-03-01 19:45:36 +0000 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2010-03-01 19:45:36 +0000 |
commit | fac49c6fc02c0bf31d0616ec6d5f6899d19f403a (patch) | |
tree | 0a039379adc44161841962828d43e59402815489 /file_io/unix | |
parent | 7b0b2b23e1a2b838b93c69d49254d8bca4dc2d42 (diff) | |
download | apr-fac49c6fc02c0bf31d0616ec6d5f6899d19f403a.tar.gz |
Use the APR_FOPEN_* constants instead of the deprecated APR_* constants
within the file_io code.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@917675 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/unix')
-rw-r--r-- | file_io/unix/copy.c | 6 | ||||
-rw-r--r-- | file_io/unix/filedup.c | 10 | ||||
-rw-r--r-- | file_io/unix/mktemp.c | 6 | ||||
-rw-r--r-- | file_io/unix/open.c | 50 | ||||
-rw-r--r-- | file_io/unix/pipe.c | 2 |
5 files changed, 37 insertions, 37 deletions
diff --git a/file_io/unix/copy.c b/file_io/unix/copy.c index 3a1c59a62..df3a49c82 100644 --- a/file_io/unix/copy.c +++ b/file_io/unix/copy.c @@ -29,7 +29,7 @@ static apr_status_t apr_file_transfer_contents(const char *from_path, apr_fileperms_t perms; /* Open source file. */ - status = apr_file_open(&s, from_path, APR_READ, APR_OS_DEFAULT, pool); + status = apr_file_open(&s, from_path, APR_FOPEN_READ, APR_OS_DEFAULT, pool); if (status) return status; @@ -101,7 +101,7 @@ APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path, apr_pool_t *pool) { return apr_file_transfer_contents(from_path, to_path, - (APR_WRITE | APR_CREATE | APR_TRUNCATE), + (APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE), perms, pool); } @@ -112,7 +112,7 @@ APR_DECLARE(apr_status_t) apr_file_append(const char *from_path, apr_pool_t *pool) { return apr_file_transfer_contents(from_path, to_path, - (APR_WRITE | APR_CREATE | APR_APPEND), + (APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_APPEND), perms, pool); } diff --git a/file_io/unix/filedup.c b/file_io/unix/filedup.c index e2c26e155..ab31e9443 100644 --- a/file_io/unix/filedup.c +++ b/file_io/unix/filedup.c @@ -35,12 +35,12 @@ static apr_status_t file_dup(apr_file_t **new_file, return APR_EINVAL; } #ifdef HAVE_DUP3 - if (!((*new_file)->flags & (APR_FILE_NOCLEANUP|APR_INHERIT))) + if (!((*new_file)->flags & (APR_FOPEN_NOCLEANUP|APR_INHERIT))) flags |= O_CLOEXEC; rv = dup3(old_file->filedes, (*new_file)->filedes, flags); #else rv = dup2(old_file->filedes, (*new_file)->filedes); - if (!((*new_file)->flags & (APR_FILE_NOCLEANUP|APR_INHERIT))) { + if (!((*new_file)->flags & (APR_FOPEN_NOCLEANUP|APR_INHERIT))) { int flags; if (rv == -1) @@ -117,12 +117,12 @@ static apr_status_t file_dup(apr_file_t **new_file, } /* apr_file_dup() retains all old_file flags with the exceptions - * of APR_INHERIT and APR_FILE_NOCLEANUP. + * of APR_INHERIT and APR_FOPEN_NOCLEANUP. * The user must call apr_file_inherit_set() on the dupped * apr_file_t when desired. */ (*new_file)->flags = old_file->flags - & ~(APR_INHERIT | APR_FILE_NOCLEANUP); + & ~(APR_INHERIT | APR_FOPEN_NOCLEANUP); apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), apr_unix_file_cleanup, @@ -175,7 +175,7 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, if (old_file->fname) { (*new_file)->fname = apr_pstrdup(p, old_file->fname); } - if (!(old_file->flags & APR_FILE_NOCLEANUP)) { + if (!(old_file->flags & APR_FOPEN_NOCLEANUP)) { apr_pool_cleanup_register(p, (void *)(*new_file), apr_unix_file_cleanup, ((*new_file)->flags & APR_INHERIT) diff --git a/file_io/unix/mktemp.c b/file_io/unix/mktemp.c index a78b73ae9..28aaf90e2 100644 --- a/file_io/unix/mktemp.c +++ b/file_io/unix/mktemp.c @@ -178,8 +178,8 @@ APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_i #ifdef HAVE_MKSTEMP int fd; #endif - flags = (!flags) ? APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | - APR_DELONCLOSE : flags; + flags = (!flags) ? APR_FOPEN_CREATE | APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_EXCL | + APR_FOPEN_DELONCLOSE : flags; #ifndef HAVE_MKSTEMP return gettemp(template, fp, flags, p); #else @@ -203,7 +203,7 @@ APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_i apr_os_file_put(fp, &fd, flags, p); (*fp)->fname = apr_pstrdup(p, template); - if (!(flags & APR_FILE_NOCLEANUP)) { + if (!(flags & APR_FOPEN_NOCLEANUP)) { int flags; if ((flags = fcntl(fd, F_GETFD)) == -1) diff --git a/file_io/unix/open.c b/file_io/unix/open.c index 78f631fc1..c2a1b7dce 100644 --- a/file_io/unix/open.c +++ b/file_io/unix/open.c @@ -39,7 +39,7 @@ static apr_status_t file_cleanup(apr_file_t *file, int is_child) if (close(fd) == 0) { /* Only the parent process should delete the file! */ - if (!is_child && (file->flags & APR_DELONCLOSE)) { + if (!is_child && (file->flags & APR_FOPEN_DELONCLOSE)) { unlink(file->fname); } #if APR_HAS_THREADS @@ -101,37 +101,37 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, apr_status_t rv; #endif - if ((flag & APR_READ) && (flag & APR_WRITE)) { + if ((flag & APR_FOPEN_READ) && (flag & APR_FOPEN_WRITE)) { oflags = O_RDWR; } - else if (flag & APR_READ) { + else if (flag & APR_FOPEN_READ) { oflags = O_RDONLY; } - else if (flag & APR_WRITE) { + else if (flag & APR_FOPEN_WRITE) { oflags = O_WRONLY; } else { return APR_EACCES; } - if (flag & APR_CREATE) { - oflags |= O_CREAT; - if (flag & APR_EXCL) { + if (flag & APR_FOPEN_CREATE) { + oflags |= O_CREAT; + if (flag & APR_FOPEN_EXCL) { oflags |= O_EXCL; } } - if ((flag & APR_EXCL) && !(flag & APR_CREATE)) { + if ((flag & APR_FOPEN_EXCL) && !(flag & APR_FOPEN_CREATE)) { return APR_EACCES; } - if (flag & APR_APPEND) { + if (flag & APR_FOPEN_APPEND) { oflags |= O_APPEND; } - if (flag & APR_TRUNCATE) { + if (flag & APR_FOPEN_TRUNCATE) { oflags |= O_TRUNC; } #ifdef O_BINARY - if (flag & APR_BINARY) { + if (flag & APR_FOPEN_BINARY) { oflags |= O_BINARY; } #endif @@ -139,7 +139,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, #ifdef O_CLOEXEC /* Introduced in Linux 2.6.23. Silently ignored on earlier Linux kernels. */ - if (!(flag & APR_FILE_NOCLEANUP)) { + if (!(flag & APR_FOPEN_NOCLEANUP)) { oflags |= O_CLOEXEC; } #endif @@ -147,13 +147,13 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, #if APR_HAS_LARGE_FILES && defined(_LARGEFILE64_SOURCE) oflags |= O_LARGEFILE; #elif defined(O_LARGEFILE) - if (flag & APR_LARGEFILE) { + if (flag & APR_FOPEN_LARGEFILE) { oflags |= O_LARGEFILE; } #endif #if APR_HAS_THREADS - if ((flag & APR_BUFFERED) && (flag & APR_XTHREAD)) { + if ((flag & APR_FOPEN_BUFFERED) && (flag & APR_FOPEN_XTHREAD)) { rv = apr_thread_mutex_create(&thlock, APR_THREAD_MUTEX_DEFAULT, pool); if (rv) { @@ -171,7 +171,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, if (fd < 0) { return errno; } - if (!(flag & APR_FILE_NOCLEANUP)) { + if (!(flag & APR_FOPEN_NOCLEANUP)) { int flags; if ((flags = fcntl(fd, F_GETFD)) == -1) @@ -192,13 +192,13 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, (*new)->fname = apr_pstrdup(pool, fname); (*new)->blocking = BLK_ON; - (*new)->buffered = (flag & APR_BUFFERED) > 0; + (*new)->buffered = (flag & APR_FOPEN_BUFFERED) > 0; if ((*new)->buffered) { (*new)->buffer = apr_palloc(pool, APR_FILE_DEFAULT_BUFSIZE); (*new)->bufsize = APR_FILE_DEFAULT_BUFSIZE; #if APR_HAS_THREADS - if ((*new)->flags & APR_XTHREAD) { + if ((*new)->flags & APR_FOPEN_XTHREAD) { (*new)->thlock = thlock; } #endif @@ -221,7 +221,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, */ (*new)->pollset = NULL; #endif - if (!(flag & APR_FILE_NOCLEANUP)) { + if (!(flag & APR_FOPEN_NOCLEANUP)) { apr_pool_cleanup_register((*new)->pool, (void *)(*new), apr_unix_file_cleanup, apr_unix_child_file_cleanup); @@ -300,8 +300,8 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, (*file)->timeout = -1; (*file)->ungetchar = -1; /* no char avail */ (*file)->filedes = *dafile; - (*file)->flags = flags | APR_FILE_NOCLEANUP; - (*file)->buffered = (flags & APR_BUFFERED) > 0; + (*file)->flags = flags | APR_FOPEN_NOCLEANUP; + (*file)->buffered = (flags & APR_FOPEN_BUFFERED) > 0; #ifndef WAITIO_USES_POLL /* Start out with no pollset. apr_wait_for_io_or_timeout() will @@ -314,7 +314,7 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, (*file)->buffer = apr_palloc(pool, APR_FILE_DEFAULT_BUFSIZE); (*file)->bufsize = APR_FILE_DEFAULT_BUFSIZE; #if APR_HAS_THREADS - if ((*file)->flags & APR_XTHREAD) { + if ((*file)->flags & APR_FOPEN_XTHREAD) { apr_status_t rv; rv = apr_thread_mutex_create(&((*file)->thlock), APR_THREAD_MUTEX_DEFAULT, pool); @@ -341,7 +341,7 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile, { int fd = STDERR_FILENO; - return apr_os_file_put(thefile, &fd, flags | APR_WRITE, pool); + return apr_os_file_put(thefile, &fd, flags | APR_FOPEN_WRITE, pool); } APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile, @@ -350,7 +350,7 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile, { int fd = STDOUT_FILENO; - return apr_os_file_put(thefile, &fd, flags | APR_WRITE, pool); + return apr_os_file_put(thefile, &fd, flags | APR_FOPEN_WRITE, pool); } APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile, @@ -359,7 +359,7 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile, { int fd = STDIN_FILENO; - return apr_os_file_put(thefile, &fd, flags | APR_READ, pool); + return apr_os_file_put(thefile, &fd, flags | APR_FOPEN_READ, pool); } APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, @@ -387,7 +387,7 @@ APR_IMPLEMENT_INHERIT_SET(file, flags, pool, apr_unix_file_cleanup) * suitable on Unix (see PR 41119). */ APR_DECLARE(apr_status_t) apr_file_inherit_unset(apr_file_t *thefile) { - if (thefile->flags & APR_FILE_NOCLEANUP) { + if (thefile->flags & APR_FOPEN_NOCLEANUP) { return APR_EINVAL; } if (thefile->flags & APR_INHERIT) { diff --git a/file_io/unix/pipe.c b/file_io/unix/pipe.c index 0411aa5f0..7b8f01fb9 100644 --- a/file_io/unix/pipe.c +++ b/file_io/unix/pipe.c @@ -149,7 +149,7 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, (*file)->ungetchar = -1; /* no char avail */ (*file)->filedes = *dafile; if (!register_cleanup) { - (*file)->flags = APR_FILE_NOCLEANUP; + (*file)->flags = APR_FOPEN_NOCLEANUP; } (*file)->buffered = 0; #if APR_HAS_THREADS |