2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

1011. [cleanup] Removed isc_dir_current().

This commit is contained in:
Andreas Gustafsson
2001-09-20 21:21:53 +00:00
parent f1491358ff
commit 1299e93989
6 changed files with 45 additions and 88 deletions

14
CHANGES
View File

@@ -1,9 +1,11 @@
1011. [cleanup] Removed isc_dir_current().
1010. [bug] The server could attempt to execute a command channel 1010. [bug] The server could attempt to execute a command channel
command after initiating server shutdown, causing command after initiating server shutdown, causing
an assertion failure. [RT #1766] an assertion failure. [RT #1766]
1009. [port] OpenUNIX 8 support. [RT #1728] 1009. [port] OpenUNIX 8 support. [RT #1728]
1008. [port] libtool.m4, ltmain.sh from libtool-1.4.2. 1008. [port] libtool.m4, ltmain.sh from libtool-1.4.2.
@@ -20,14 +22,14 @@
1003. [func] Add the +retry option to dig. 1003. [func] Add the +retry option to dig.
1002. [bug] Log unknown class including file and line. [RT #1759] 1002. [bug] Log unknown class including file and line. [RT #1759]
1001. [bug] win32 socket code doio_recv was not catching a 1001. [bug] win32 socket code doio_recv was not catching a
WSACONNRESET error when a client was timing out WSACONNRESET error when a client was timing out
the request and closing its socket. [RT #1745] the request and closing its socket. [RT #1745]
1000. [bug] BIND 8 compatibility: accept "HESIOD" as an alias 1000. [bug] BIND 8 compatibility: accept "HESIOD" as an alias
for class "HS". [RT #1759] for class "HS". [RT #1759]
999. [func] "rndc retransfer zone [class [view]]" added. 999. [func] "rndc retransfer zone [class [view]]" added.
[RT #1752] [RT #1752]
@@ -104,7 +106,7 @@
977. [bug] Improve "not at top of zone" error message. 977. [bug] Improve "not at top of zone" error message.
976. [func] named-checkconf can now test load master zones 976. [func] named-checkconf can now test load master zones
(named-checkconf -z). [RT #1468] (named-checkconf -z). [RT #1468]
975. [bug] "max-cache-size default;" as a view option 975. [bug] "max-cache-size default;" as a view option
caused an assertion failure. caused an assertion failure.
@@ -117,7 +119,7 @@
(NOTAUTH)". (NOTAUTH)".
972. [bug] The file modification time code in zone.c was using the 972. [bug] The file modification time code in zone.c was using the
wrong epoch. [RT #1667] wrong epoch. [RT #1667]
971. [func] 'try-edns' can be use to disable edns on all queries. 971. [func] 'try-edns' can be use to disable edns on all queries.
@@ -2471,7 +2473,7 @@
257. [bug] The server detached the last zone manager reference 257. [bug] The server detached the last zone manager reference
too early, while it could still be in use by queries. too early, while it could still be in use by queries.
This manifested itself as assertion failures during the This manifested itself as assertion failures during the
shutdown process for busy name servers [RT #133]. shutdown process for busy name servers. [RT #133]
256. [func] isc_ratelimiter_t now has attach/detach semantics, and 256. [func] isc_ratelimiter_t now has attach/detach semantics, and
isc_ratelimiter_shutdown guarantees that the rate isc_ratelimiter_shutdown guarantees that the rate

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dir.c,v 1.18 2001/06/08 23:50:31 tale Exp $ */ /* $Id: dir.c,v 1.19 2001/09/20 21:21:48 gson Exp $ */
/* Principal Authors: DCL */ /* Principal Authors: DCL */
@@ -155,34 +155,6 @@ isc_dir_chroot(const char *dirname) {
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
isc_result_t
isc_dir_current(char *dirname, size_t length, isc_boolean_t end_sep) {
char *cwd;
isc_result_t result = ISC_R_SUCCESS;
/*
* XXXDCL Could automatically allocate memory if dirname == NULL.
*/
REQUIRE(dirname != NULL);
REQUIRE(length > 0);
cwd = getcwd(dirname, length);
if (cwd == NULL) {
if (errno == ERANGE)
result = ISC_R_NOSPACE;
else
result = isc__errno2result(errno);
} else if (end_sep) {
if (strlen(dirname) + 1 == length)
result = ISC_R_NOSPACE;
else if (dirname[1] != '\0')
strcat(dirname, "/");
}
return (result);
}
isc_result_t isc_result_t
isc_dir_createunique(char *templet) { isc_dir_createunique(char *templet) {
isc_result_t result; isc_result_t result;

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.40 2001/08/30 20:55:37 gson Exp $ */ /* $Id: file.c,v 1.41 2001/09/20 21:21:49 gson Exp $ */
#include <config.h> #include <config.h>
@@ -301,10 +301,41 @@ isc_file_progname(const char *filename, char *buf, size_t buflen) {
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
/*
* Put the absolute name of the current directory into 'dirname', which is
* a buffer of at least 'length' characters. End the string with the
* appropriate path separator, such that the final product could be
* concatenated with a relative pathname to make a valid pathname string.
*/
static isc_result_t
dir_current(char *dirname, size_t length) {
char *cwd;
isc_result_t result = ISC_R_SUCCESS;
REQUIRE(dirname != NULL);
REQUIRE(length > 0);
cwd = getcwd(dirname, length);
if (cwd == NULL) {
if (errno == ERANGE)
result = ISC_R_NOSPACE;
else
result = isc__errno2result(errno);
} else {
if (strlen(dirname) + 1 == length)
result = ISC_R_NOSPACE;
else if (dirname[1] != '\0')
strcat(dirname, "/");
}
return (result);
}
isc_result_t isc_result_t
isc_file_absolutepath(const char *filename, char *path, size_t pathlen) { isc_file_absolutepath(const char *filename, char *path, size_t pathlen) {
isc_result_t result; isc_result_t result;
result = isc_dir_current(path, pathlen, ISC_TRUE); result = dir_current(path, pathlen);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
if (strlen(path) + strlen(filename) + 1 > pathlen) if (strlen(path) + strlen(filename) + 1 > pathlen)

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dir.h,v 1.15 2001/08/28 03:58:27 marka Exp $ */ /* $Id: dir.h,v 1.16 2001/09/20 21:21:50 gson Exp $ */
/* Principal Authors: DCL */ /* Principal Authors: DCL */
@@ -76,16 +76,6 @@ isc_dir_chdir(const char *dirname);
isc_result_t isc_result_t
isc_dir_chroot(const char *dirname); isc_dir_chroot(const char *dirname);
isc_result_t
isc_dir_current(char *dirname, size_t length, isc_boolean_t end_sep);
/*
* Put the absolute name of the current directory into 'dirname', which is a
* buffer of at least 'length' characters. If 'end_sep' is true, end the
* string with the appropriate path separator, such that the final product
* could be concatenated with a relative pathname to make a valid pathname
* string.
*/
isc_result_t isc_result_t
isc_dir_createunique(char *templet); isc_dir_createunique(char *templet);
/* /*

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dir.c,v 1.10 2001/07/06 21:47:15 gson Exp $ */ /* $Id: dir.c,v 1.11 2001/09/20 21:21:52 gson Exp $ */
/* Principal Authors: DCL */ /* Principal Authors: DCL */
@@ -245,34 +245,6 @@ isc_dir_chroot(const char *dirname) {
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
isc_result_t
isc_dir_current(char *dirname, size_t length, isc_boolean_t end_sep) {
char *cwd;
isc_result_t result = ISC_R_SUCCESS;
/*
* XXXDCL Could automatically allocate memory if dirname == NULL.
*/
REQUIRE(dirname != NULL);
REQUIRE(length > 0);
cwd = getcwd(dirname, length);
if (cwd == NULL) {
if (errno == ERANGE)
result = ISC_R_NOSPACE;
else
result = isc__errno2result(errno);
} else if (end_sep) {
if (strlen(dirname) + 1 == length)
result = ISC_R_NOSPACE;
else if (dirname[1] != '\0')
strcat(dirname, "/");
}
return (result);
}
isc_result_t isc_result_t
isc_dir_createunique(char *templet) { isc_dir_createunique(char *templet) {
isc_result_t result; isc_result_t result;

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dir.h,v 1.11 2001/08/28 03:58:29 marka Exp $ */ /* $Id: dir.h,v 1.12 2001/09/20 21:21:53 gson Exp $ */
/* Principal Authors: DCL */ /* Principal Authors: DCL */
@@ -69,16 +69,6 @@ isc_dir_chdir(const char *dirname);
isc_result_t isc_result_t
isc_dir_chroot(const char *dirname); isc_dir_chroot(const char *dirname);
isc_result_t
isc_dir_current(char *dirname, size_t length, isc_boolean_t end_sep);
/*
* Put the absolute name of the current directory into 'dirname', which is a
* buffer of at least 'length' characters. If 'end_sep' is true, end the
* string with the appropriate path separator, such that the final product
* could be concatenated with a relative pathname to make a valid pathname
* string.
*/
isc_result_t isc_result_t
isc_dir_createunique(char *templet); isc_dir_createunique(char *templet);
/* /*