summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/logadm/conf.c28
-rw-r--r--usr/src/cmd/logadm/main.c4
2 files changed, 18 insertions, 14 deletions
diff --git a/usr/src/cmd/logadm/conf.c b/usr/src/cmd/logadm/conf.c
index 5e0f053333..0d22957a5e 100644
--- a/usr/src/cmd/logadm/conf.c
+++ b/usr/src/cmd/logadm/conf.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2013, Joyent, Inc. All rights reserved.
*/
/*
@@ -173,8 +174,7 @@ nexttok(char **ptrptr)
* returns: 0: error, 1: ok, 3: -P option found
*/
static int
-conf_scan(const char *fname, char *buf, int buflen, int timescan,
- struct opts *cliopts)
+conf_scan(const char *fname, char *buf, int buflen, int timescan)
{
int ret = 1;
int lineno = 0;
@@ -275,17 +275,21 @@ conf_scan(const char *fname, char *buf, int buflen, int timescan,
if (timescan) {
/* append to config options */
cp = lut_lookup(Conflut, entry);
- if (cp == NULL) {
- /* orphaned entry */
- if (opts_count(cliopts, "v"))
- err(EF_FILE, "stale timestamp "
- "for %s", entry);
- LOCAL_ERR_BREAK;
+ if (cp != NULL) {
+ opts = cp->cf_opts;
}
- opts = cp->cf_opts;
}
opts = opts_parse(opts, Args, OPTF_CONF);
- if (!timescan) {
+ if (!timescan || cp == NULL) {
+ /*
+ * If we're not doing timescan, we track this
+ * entry. If we are doing timescan and have
+ * what looks like an orphaned entry (cp ==
+ * NULL) then we also have to track. See the
+ * comment in rotatelog. We need to allow for
+ * the case where the logname is not the same as
+ * the log file name.
+ */
fillconflist(lineno, entry, opts, comment, 0);
}
LOCAL_ERR_END }
@@ -405,7 +409,7 @@ conf_open(const char *cfname, const char *tfname, struct opts *cliopts)
PROT_READ | PROT_WRITE, MAP_PRIVATE, Conffd, 0)) == (char *)-1)
err(EF_SYS, "mmap on %s", Confname);
- ret = conf_scan(Confname, Confbuf, Conflen, 0, cliopts);
+ ret = conf_scan(Confname, Confbuf, Conflen, 0);
if (ret == 3 && !Singlefile && Canchange == CHG_BOTH) {
/*
* arrange to transfer any timestamps
@@ -419,7 +423,7 @@ conf_open(const char *cfname, const char *tfname, struct opts *cliopts)
PROT_READ | PROT_WRITE, MAP_PRIVATE,
Timesfd, 0)) == (char *)-1)
err(EF_SYS, "mmap on %s", Timesname);
- ret &= conf_scan(Timesname, Timesbuf, Timeslen, 1, cliopts);
+ ret &= conf_scan(Timesname, Timesbuf, Timeslen, 1);
}
/*
diff --git a/usr/src/cmd/logadm/main.c b/usr/src/cmd/logadm/main.c
index b03782c3c3..219d644de2 100644
--- a/usr/src/cmd/logadm/main.c
+++ b/usr/src/cmd/logadm/main.c
@@ -648,7 +648,7 @@ rotatelog(struct fn *fnp, struct opts *opts)
* last rotation is recorded as argument to -P,
* but if logname isn't the same as log file name
* then the timestamp would be recorded on a
- * separate line in the conf file. so if we
+ * separate line in the timestamp file. so if we
* haven't seen a -P already, we check to see if
* it is part of a specific entry for the log
* file name. this handles the case where the
@@ -657,7 +657,7 @@ rotatelog(struct fn *fnp, struct opts *opts)
* which expands to multiple file names. if one
* of the file names is "/var/apache/logs/access_log"
* the the -P will be attached to a line with that
- * logname in the conf file.
+ * logname in the timestamp file.
*/
if (opts_count(opts, "P")) {
off_t last = opts_optarg_int(opts, "P");