问题描述
||
我对Apache可移植运行时库(版本1.4)进行了以下调用:
result = apr_file_open(
&file,// new file handle
pathname,// file name
APR_FOPEN_CREATE | // create file if not there
APR_FOPEN_EXCL | // error if file was there already
APR_FOPEN_APPEND | // move to end of file on open
APR_FOPEN_BINARY | // binary mode (ignored on UNIX)
APR_FOPEN_XTHREAD | // allow multiple threads to use file
0,// flags
APR_OS_DEFAULT |
0,// permissions
pool // memory pool to use
);
if ( APR_SUCCESS != result ) {
fprintf(
stderr,\"Could not create file \\\"%s\\\": %s\",pathname,apr_errorstr( result )
);
}
pathname
包含字符串/tmp/tempfile20110614091201
。
我不断收到错误“权限被拒绝”(结果代码为3),但我具有对4进行读/写的权限-这是什么引起的?
解决方法
我需要ѭ5标志。我错误地认为ѭ6标志已足够。
因此,有效的呼叫是:
result = apr_file_open(
&file,// new file handle
pathname,// file name
APR_FOPEN_CREATE | // create file if not there
APR_FOPEN_EXCL | // error if file was there already
APR_FOPEN_WRITE | // open for writing
APR_FOPEN_APPEND | // move to end of file on open
APR_FOPEN_BINARY | // binary mode (ignored on UNIX)
APR_FOPEN_XTHREAD | // allow multiple threads to use file
0,// flags
APR_OS_DEFAULT |
0,// permissions
pool // memory pool to use
);