]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
added unix implementation of isc_file_absolutepath()
authorAndreas Gustafsson <source@isc.org>
Mon, 16 Jul 2001 17:26:44 +0000 (17:26 +0000)
committerAndreas Gustafsson <source@isc.org>
Mon, 16 Jul 2001 17:26:44 +0000 (17:26 +0000)
lib/isc/unix/file.c

index b145130bc7e2dd8a66cc5a17b3fdeab8f310f58e..e599986e10535058c12b4fa4a961c9641dd9cb7a 100644 (file)
@@ -15,7 +15,7 @@
  * 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>
 
@@ -28,6 +28,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 
+#include <isc/dir.h>
 #include <isc/file.h>
 #include <isc/string.h>
 #include <isc/time.h>
@@ -290,3 +291,15 @@ isc_file_progname(const char *filename, char *buf, size_t buflen) {
 
        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);
+}