On 10/20/13 5:31 AM, Ruediger Pluem wrote: >> apr_pool_create(&newlog.pool, status->pool); >> + if (config->create_path) { >> + char *ptr = strrchr(newlog.name, '/'); >> + if (ptr && ptr > newlog.name) { >> + char *path = apr_pstrmemdup(newlog.pool, newlog.name, ptr - >> newlog.name); >> + if (config->verbose) { >> + fprintf(stderr, "Creating directory tree %s\n", path); >> + } >> + rv = apr_dir_make_recursive(path, APR_FPROT_OS_DEFAULT, >> newlog.pool); >> + if (rv != APR_SUCCESS) { >> + char error[120]; >> + >> + apr_strerror(rv, error, sizeof error); >> + fprintf(stderr, "Could not create directory '%s' (%s)\n", >> path, error); > > Can't we use apr_psprintf with %pm instead of the constant length buffer > char [120]?
Only if we require APR 1.3.x or newer since %pm wasn't added till 1.3.0: https://apr.apache.org/docs/apr/1.4/group__apr__lib.html#gad2cd3594aeaafd45931d1034965f48c1 The implementation I used here is similar to out error handling already in the file.