+ 815. [bug] If a log file was specified with a path separator
+ character (i.e. "/") in its name and the directory
+ did not exist, the log file's name was treated as
+ though it were the directory name. [RT #1189]
+
814. [bug] Socket objects left over from accept() failures
were incorrectly destroyed, causing corruption
of socket manager data structures.
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.55.2.1 2001/01/09 22:49:05 bwelling Exp $ */
+/* $Id: log.c,v 1.55.2.2 2001/04/28 01:16:26 gson Exp $ */
/* Principal Authors: DCL */
static isc_result_t
sync_channellist(isc_logconfig_t *lcfg);
-static unsigned int
-greatest_version(isc_logchannel_t *channel);
+static isc_result_t
+greatest_version(isc_logchannel_t *channel, int *greatest);
static isc_result_t
roll_log(isc_logchannel_t *channel);
return (ISC_R_SUCCESS);
}
-static unsigned int
-greatest_version(isc_logchannel_t *channel) {
+static isc_result_t
+greatest_version(isc_logchannel_t *channel, int *greatestp) {
/* XXXDCL HIGHLY NT */
char *basename, *digit_end;
const char *dirname;
}
basenamelen = strlen(basename);
-
isc_dir_init(&dir);
result = isc_dir_open(&dir, dirname);
+
+ /*
+ * Replace the file separator if it was taken out.
+ */
+ if (basename != FILE_NAME(channel))
+ *(basename - 1) = '/';
+
+ /*
+ * Return if the directory open failed.
+ */
if (result != ISC_R_SUCCESS)
- return (0); /* ... and roll_log will likely report an error. */
+ return (result);
while (isc_dir_read(&dir) == ISC_R_SUCCESS) {
if (dir.entry.length > basenamelen &&
dir.entry.name[basenamelen] == '.') {
version = strtol(&dir.entry.name[basenamelen + 1],
- &digit_end, 10);
+ &digit_end, 10);
if (*digit_end == '\0' && version > greatest)
greatest = version;
}
}
isc_dir_close(&dir);
- if (basename != FILE_NAME(channel))
- *--basename = '/';
+ *greatestp = ++greatest;
- return (++greatest);
+ return (ISC_R_SUCCESS);
}
static isc_result_t
char current[FILENAME_MAX + 1];
char new[FILENAME_MAX + 1];
const char *path;
+ isc_result_t result;
/*
* Do nothing (not even excess version trimming) if ISC_LOG_ROLLNEVER
* though the file names are 0 based, so an oldest log of log.1
* is a greatest_version of 2.
*/
- greatest = greatest_version(channel);
+ result = greatest_version(channel, &greatest);
+ if (result != ISC_R_SUCCESS)
+ return (result);
/*
* Now greatest should be set to the highest version number desired.