2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

added unix implementation of isc_file_absolutepath()

This commit is contained in:
Andreas Gustafsson 2001-07-16 17:26:44 +00:00
parent dee69dd3aa
commit a548a3c20c

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: file.c,v 1.36 2001/07/10 04:23:01 bwelling Exp $ */ /* $Id: file.c,v 1.37 2001/07/16 17:26:44 gson Exp $ */
#include <config.h> #include <config.h>
@ -28,6 +28,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <isc/dir.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/time.h> #include <isc/time.h>
@ -290,3 +291,15 @@ isc_file_progname(const char *filename, char *buf, size_t buflen) {
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
isc_result_t
isc_file_absolutepath(const char *filename, char *path, size_t pathlen) {
isc_result_t result;
result = isc_dir_current(path, pathlen, ISC_TRUE);
if (result != ISC_R_SUCCESS)
return (result);
if (strlen(path) + strlen(filename) + 1 > pathlen)
return (ISC_R_NOSPACE);
strcat(path, filename);
return (ISC_R_SUCCESS);
}