apr_status_t status;
char *nfrom, *nto, *from, *to;
apr_pool_t *pool;
- char errbuf[HUGE_STRING_LEN];
apr_pool_create(&pool, file->pool);
if (APR_SUCCESS != (status = apr_file_rename(nfrom, nto, pool))) {
apr_file_printf(
file->file_err,
- "Could not rename file '%s' to '%s' for fragment write: %s\n",
- nfrom, nto,
- apr_strerror(status, errbuf, sizeof(errbuf)));
+ "Could not rename file '%s' to '%s' for fragment write: %pm\n",
+ nfrom, nto, &status);
}
}
else {
apr_file_printf(
file->file_err,
- "Could not set mtime on file '%s' to '%" APR_TIME_T_FMT "' for fragment write: %s\n",
- nfrom, file->end,
- apr_strerror(status, errbuf, sizeof(errbuf)));
+ "Could not set mtime on file '%s' to '%" APR_TIME_T_FMT "' for fragment write: %pm\n",
+ nfrom, file->end, &status);
}
}
else {
apr_file_printf(file->file_err,
- "Could not merge directory '%s' with file '%s': %s\n",
- file->directory, to, apr_strerror(status, errbuf,
- sizeof(errbuf)));
+ "Could not merge directory '%s' with file '%s': %pm\n",
+ file->directory, to, &status);
}
}
else {
apr_file_printf(file->file_err,
- "Could not merge directory '%s' with file '%s': %s\n",
- file->directory, from, apr_strerror(status, errbuf,
- sizeof(errbuf)));
+ "Could not merge directory '%s' with file '%s': %pm\n",
+ file->directory, from, &status);
}
apr_pool_destroy(pool);
char *native, *name;
apr_pool_t *pool;
apr_file_t *handle;
- char errbuf[HUGE_STRING_LEN];
if (!file->start) {
file->start = header->timestamp;
if (APR_SUCCESS != (status = apr_file_write_full(handle, str, len,
&len))) {
apr_file_printf(file->file_err,
- "Could not write fragment body to file '%s': %s\n",
- native, apr_strerror(status, errbuf, sizeof(errbuf)));
+ "Could not write fragment body to file '%s': %pm\n",
+ native, &status);
}
}
else {
apr_file_printf(file->file_err,
- "Could not open file '%s' for fragment write: %s\n",
- native, apr_strerror(status, errbuf, sizeof(errbuf)));
+ "Could not open file '%s' for fragment write: %pm\n",
+ native, &status);
}
}
else {
apr_file_printf(file->file_err,
- "Could not merge directory '%s' with file '%s': %s\n",
- file->directory, name, apr_strerror(status, errbuf,
- sizeof(errbuf)));
+ "Could not merge directory '%s' with file '%s': %pm\n",
+ file->directory, name, &status);
}
apr_pool_destroy(pool);
*/
static apr_status_t demux(file_rec *file)
{
- char errbuf[HUGE_STRING_LEN];
apr_size_t len = 0;
apr_status_t status = APR_SUCCESS;
apr_bucket *b, *e;
header.len, &e))) {
apr_file_printf(
file->file_err,
- "Could not read fragment body from input file: %s\n",
- apr_strerror(status, errbuf, sizeof(errbuf)));
+ "Could not read fragment body from input file: %pm\n", &status);
break;
}
while ((b = APR_BRIGADE_FIRST(bb)) && e != b) {
}
else {
apr_file_printf(file->file_err,
- "Could not read fragment header from input file: %s\n",
- apr_strerror(status, errbuf, sizeof(errbuf)));
+ "Could not read fragment header from input file: %pm\n", &status);
break;
}
APR_OS_DEFAULT, pool);
if (status != APR_SUCCESS) {
apr_file_printf(file->file_err,
- "Could not open file '%s' for read: %s\n", optarg,
- apr_strerror(status, errmsg, sizeof errmsg));
+ "Could not open file '%s' for read: %pm\n", optarg, &status);
return 1;
}
break;
status = apr_stat(&finfo, optarg, APR_FINFO_TYPE, pool);
if (status != APR_SUCCESS) {
apr_file_printf(file->file_err,
- "Directory '%s' could not be found: %s\n", optarg,
- apr_strerror(status, errmsg, sizeof errmsg));
+ "Directory '%s' could not be found: %pm\n", optarg, &status);
return 1;
}
if (finfo.filetype != APR_DIR) {
return rv;
}
if (rv != APR_SUCCESS) {
- char errmsg[120];
- apr_file_printf(errfile, "Could not open directory %s: %s" APR_EOL_STR,
- dir, apr_strerror(rv, errmsg, sizeof errmsg));
+ apr_file_printf(errfile, "Could not open directory %s: %pm" APR_EOL_STR,
+ dir, &rv);
return rv;
}
const char *file = apr_pstrcat(pool, dir, "/", dirent.name, NULL);
rv = apr_file_remove(file, pool);
if (APR_SUCCESS != rv) {
- char errmsg[120];
apr_file_printf(errfile,
- "Could not remove file '%s': %s" APR_EOL_STR, file,
- apr_strerror(rv, errmsg, sizeof errmsg));
+ "Could not remove file '%s': %pm" APR_EOL_STR, file,
+ &rv);
break;
}
}
rv = APR_SUCCESS;
}
if (rv != APR_SUCCESS) {
- char errmsg[120];
- apr_file_printf(errfile, "Could not remove directory %s: %s" APR_EOL_STR,
- dir, apr_strerror(rv, errmsg, sizeof errmsg));
+ apr_file_printf(errfile, "Could not remove directory %s: %pm" APR_EOL_STR,
+ dir, &rv);
}
}
rv = apr_dir_open(&dirp, base, pool);
if (rv != APR_SUCCESS) {
- char errmsg[120];
- apr_file_printf(errfile, "Could not open directory %s: %s" APR_EOL_STR,
- base, apr_strerror(rv, errmsg, sizeof errmsg));
+ apr_file_printf(errfile, "Could not open directory %s: %pm" APR_EOL_STR,
+ base, &rv);
return rv;
}
remove = apr_pstrcat(pool, base, "/", header, NULL);
status = apr_file_remove(remove, pool);
if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
- char errmsg[120];
- apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR,
- remove, apr_strerror(status, errmsg, sizeof errmsg));
+ apr_file_printf(errfile, "Could not remove file %s: %pm" APR_EOL_STR,
+ remove, &status);
rv = status;
}
remove = apr_pstrcat(pool, base, "/", data, NULL);
status = apr_file_remove(remove, pool);
if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
- char errmsg[120];
- apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR,
- remove, apr_strerror(status, errmsg, sizeof errmsg));
+ apr_file_printf(errfile, "Could not remove file %s: %pm" APR_EOL_STR,
+ remove, &status);
rv = status;
}
static void log_pid(apr_pool_t *pool, const char *pidfilename, apr_file_t **pidfile)
{
apr_status_t status;
- char errmsg[120];
pid_t mypid = getpid();
if (APR_SUCCESS == (status = apr_file_open(pidfile, pidfilename,
else {
if (errfile) {
apr_file_printf(errfile,
- "Could not write the pid file '%s': %s" APR_EOL_STR,
- pidfilename,
- apr_strerror(status, errmsg, sizeof errmsg));
+ "Could not write the pid file '%s': %pm" APR_EOL_STR,
+ pidfilename, &status);
}
exit(1);
}
}
proxypath = apr_pstrdup(pool, arg);
if ((status = apr_filepath_set(proxypath, pool)) != APR_SUCCESS) {
- usage(apr_psprintf(pool, "Could not set filepath to '%s': %s",
- proxypath, apr_strerror(status, errmsg, sizeof errmsg)));
+ usage(apr_psprintf(pool, "Could not set filepath to '%s': %pm",
+ proxypath, &status));
}
break;
}
if (apr_filepath_get(&path, 0, pool) != APR_SUCCESS) {
- usage(apr_psprintf(pool, "Could not get the filepath: %s",
- apr_strerror(status, errmsg, sizeof errmsg)));
+ usage(apr_psprintf(pool, "Could not get the filepath: %pm", &status));
}
baselen = strlen(path);