OpenBSD CVS

CVS log for src/usr.bin/newsyslog/newsyslog.c


[BACK] Up to [local] / src / usr.bin / newsyslog

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.114 / (download) - annotate - [select for diffs], Mon Apr 22 14:20:35 2024 UTC (3 weeks, 5 days ago) by millert
Branch: MAIN
CVS Tags: HEAD
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored)

newsyslog: allow the F flag to be used on its own.
Fixes a conditional that lacked a check for 'F' or 'f'.
From Alvar Penning.

Revision 1.113 / (download) - annotate - [select for diffs], Wed Mar 8 04:43:12 2023 UTC (14 months, 1 week ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.112: +1 -2 lines
Diff to previous 1.112 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.112 / (download) - annotate - [select for diffs], Fri Jun 28 13:35:02 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.111: +6 -6 lines
Diff to previous 1.111 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.111 / (download) - annotate - [select for diffs], Fri Jun 28 05:35:34 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.110: +2 -2 lines
Diff to previous 1.110 (colored)

mkstemp() returns -1 on failure

Revision 1.110 / (download) - annotate - [select for diffs], Fri Jan 25 00:19:26 2019 UTC (5 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.109: +2 -2 lines
Diff to previous 1.109 (colored)

I am retiring my old email address;  replace it with my OpenBSD one.

Revision 1.109 / (download) - annotate - [select for diffs], Sun Sep 16 02:44:06 2018 UTC (5 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.108: +23 -29 lines
Diff to previous 1.108 (colored)

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups.  OK tb@

Revision 1.108 / (download) - annotate - [select for diffs], Mon Jul 24 12:57:01 2017 UTC (6 years, 9 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.107: +4 -20 lines
Diff to previous 1.107 (colored)

Simplify mail sending.

No need for asprintf(3) to concat two string literals.  The resulting
helper() function is trivial, so inline it.  ok schwarze@

Revision 1.107 / (download) - annotate - [select for diffs], Sat Jul 22 17:06:40 2017 UTC (6 years, 9 months ago) by jca
Branch: MAIN
Changes since 1.106: +6 -6 lines
Diff to previous 1.106 (colored)

Delete extra whitespaces

Revision 1.106 / (download) - annotate - [select for diffs], Sat Jul 22 17:05:14 2017 UTC (6 years, 9 months ago) by jca
Branch: MAIN
Changes since 1.105: +11 -11 lines
Diff to previous 1.105 (colored)

err(1, "whatever") -> err(1, NULL) for malloc(3) failures

Revision 1.105 / (download) - annotate - [select for diffs], Thu Jul 20 18:39:16 2017 UTC (6 years, 10 months ago) by jca
Branch: MAIN
Changes since 1.104: +100 -41 lines
Diff to previous 1.104 (colored)

Don't exit on invalid config lines, yet return a proper exit status.

newsyslog(8) is mainly used to proces log files, not rotating them
because of an invalid field means that /var will end up full.
Initially I wanted to ignore only getpwnam/getgrnam errors, but millert@
convinced me otherwise.  malloc(3) errors are still fatal.

Diff prompted by a report from Harald Dunkel, ok millert@

Revision 1.104 / (download) - annotate - [select for diffs], Fri Jul 14 22:17:16 2017 UTC (6 years, 10 months ago) by jca
Branch: MAIN
Changes since 1.103: +2 -3 lines
Diff to previous 1.103 (colored)

Don't bother freeing memory just before exiting.

Suggested by & ok bluhm@

Revision 1.103 / (download) - annotate - [select for diffs], Fri Jul 14 20:51:17 2017 UTC (6 years, 10 months ago) by jca
Branch: MAIN
Changes since 1.102: +32 -44 lines
Diff to previous 1.102 (colored)

TAILQs instead of hand-rolled lists

ok millert@

Revision 1.102 / (download) - annotate - [select for diffs], Thu Mar 16 10:32:01 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.101: +11 -5 lines
Diff to previous 1.101 (colored)

syslogd(8) -Z generates log files with time in ISO format and UTC.
newsyslog(8) still used the traditional BSD syslog timstamps in
local time zone.  Convert the latter to the new format unconditionally.
It is usefull to have a distinct timestamp including the year at
the beginning of every logfile.
OK deraadt@ jung@

Revision 1.101 / (download) - annotate - [select for diffs], Wed Jun 1 16:57:48 2016 UTC (7 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.100: +7 -27 lines
Diff to previous 1.100 (colored)

instead of using the makefile to override ancient defaults in the code,
change the code to reflect modern reality.
ok deraadt millert natano

Revision 1.100 / (download) - annotate - [select for diffs], Mon Jan 11 19:26:04 2016 UTC (8 years, 4 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.99: +2 -2 lines
Diff to previous 1.99 (colored)

ajacoutot@ reported seeing

newsyslog: preposterous process number in pid file: /var/run/syslog.pid

in his log since syslogd ran as pid 2.

Nowadays only init runs with a reserved low pid, so decrease MIN_PID
from 4 to 2, as suggested by espie@.

ok kettenis@

Revision 1.99 / (download) - annotate - [select for diffs], Wed Dec 9 19:28:34 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
Changes since 1.98: +2 -3 lines
Diff to previous 1.98 (colored)

Remove NULL-checks before free(). ok tb@

Revision 1.98 / (download) - annotate - [select for diffs], Thu Nov 19 08:23:48 2015 UTC (8 years, 6 months ago) by sthen
Branch: MAIN
Changes since 1.97: +1 -7 lines
Diff to previous 1.97 (colored)

backout pledge completely for now, newsyslog needs chown() which is restricted

Revision 1.97 / (download) - annotate - [select for diffs], Wed Nov 18 19:59:24 2015 UTC (8 years, 6 months ago) by sthen
Branch: MAIN
Changes since 1.96: +1 -4 lines
Diff to previous 1.96 (colored)

don't drop "pledge exec", it's needed for compression. ok deraadt@

Revision 1.96 / (download) - annotate - [select for diffs], Tue Nov 17 14:51:42 2015 UTC (8 years, 6 months ago) by benno
Branch: MAIN
Changes since 1.95: +10 -1 lines
Diff to previous 1.95 (colored)

pledge() in newsyslog.
go deraadt@

Revision 1.95 / (download) - annotate - [select for diffs], Thu Aug 20 22:32:41 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.94: +3 -3 lines
Diff to previous 1.94 (colored)

Do not cast result of malloc/calloc/realloc* if stdlib.h is in scope
ok krw millert

Revision 1.94 / (download) - annotate - [select for diffs], Sun Feb 8 23:40:34 2015 UTC (9 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.93: +5 -5 lines
Diff to previous 1.93 (colored)

in getopt() blocks, stop incrementing flag variable which are supposed
to just be 0/1
ok miod florian

Revision 1.93 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:10 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.92: +12 -12 lines
Diff to previous 1.92 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.92 / (download) - annotate - [select for diffs], Tue Nov 26 13:19:07 2013 UTC (10 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.91: +9 -8 lines
Diff to previous 1.91 (colored)

unsigned char casts for ctype
ok krw

Revision 1.91 / (download) - annotate - [select for diffs], Fri Apr 5 01:29:07 2013 UTC (11 years, 1 month ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.90: +5 -5 lines
Diff to previous 1.90 (colored)

rename a variable to hours so it doesn't look like time. ok deraadt guenther

Revision 1.90 / (download) - annotate - [select for diffs], Sun Jan 15 13:02:12 2012 UTC (12 years, 4 months ago) by phessler
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.89: +3 -1 lines
Diff to previous 1.89 (colored)

When we only rotate a log file once a month, the "next rotate" output
shows the current month, even when that date has passed.

Fix to show the correct rotation date.

pointed out by jeremy@
OK jeremy@, guenther@, miod@

Revision 1.89 / (download) - annotate - [select for diffs], Thu May 19 05:11:39 2011 UTC (13 years ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

sync manpage and comment with reality. From Nathanael Rensen.

ok millert@

Revision 1.88 / (download) - annotate - [select for diffs], Sat Jul 24 00:54:46 2010 UTC (13 years, 9 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored)

Include pid file name in error message for a failed kill(). Prompted by
PR 6288.

ok deraadt

Revision 1.87 / (download) - annotate - [select for diffs], Sat Mar 20 15:15:45 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +17 -14 lines
Diff to previous 1.86 (colored)

The newsyslog(8) utility used to keep one archived log file more than
requested; bug reported and patch sent by David Alten.
I resolved the problem in a different way, also fixing the following
additional issue:  When you reduced the "count" in newsyslog.conf(5),
the archived logs with higher numbers got orphaned and never deleted.
Nic fixed another off-by-one error in this patch, thanks!

"I like it; definitely cleaner"  DAlten at friedkin dot com
ok nicm@

Revision 1.86 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:40 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.85: +1 -5 lines
Diff to previous 1.85 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.85 / (download) - annotate - [select for diffs], Thu Sep 10 13:03:35 2009 UTC (14 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.84: +5 -5 lines
Diff to previous 1.84 (colored)

Correct error message when fclose() fails.  From Brian Poole.

Revision 1.84 / (download) - annotate - [select for diffs], Tue Mar 20 03:50:39 2007 UTC (17 years, 2 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.83: +5 -3 lines
Diff to previous 1.83 (colored)

remove some bogus *p tests from charles longeau
ok deraadt millert

Revision 1.83 / (download) - annotate - [select for diffs], Mon Dec 11 20:50:54 2006 UTC (17 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.82: +3 -2 lines
Diff to previous 1.82 (colored)

rfc 3834 support: Auto-Submitted: auto-generated on lots of things; from Tamas TEVESZ; ok millert

Revision 1.82 / (download) - annotate - [select for diffs], Tue Sep 14 22:25:33 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.81: +3 -2 lines
Diff to previous 1.81 (colored)

ARGSUSED before signal handler with unused signo

Revision 1.81 / (download) - annotate - [select for diffs], Sun Jul 11 17:21:21 2004 UTC (19 years, 10 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.80: +26 -15 lines
Diff to previous 1.80 (colored)

Make newsyslog(8) deal correctly with a count of 0 in newsyslog.conf.
Based on a diff from Matthew Gream.

Revision 1.80 / (download) - annotate - [select for diffs], Mon May 10 05:32:16 2004 UTC (20 years ago) by deraadt
Branch: MAIN
Changes since 1.79: +27 -32 lines
Diff to previous 1.79 (colored)

pretty

Revision 1.79 / (download) - annotate - [select for diffs], Fri Apr 9 19:21:15 2004 UTC (20 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.78: +57 -68 lines
Diff to previous 1.78 (colored)

If no user/group is specified for the log file in newsyslog.conf,
use the uid/gid of the existing log file.  OK deraadt@

Revision 1.78 / (download) - annotate - [select for diffs], Tue Apr 6 22:23:04 2004 UTC (20 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.77: +18 -7 lines
Diff to previous 1.77 (colored)

Set mode and ownership when renaming file -> file.0 like we do when
moving the file across filesystems or renaming from file.0 -> file.1.
Problem noticed by mpech@

Revision 1.77 / (download) - annotate - [select for diffs], Mon Apr 5 19:41:50 2004 UTC (20 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.76: +11 -7 lines
Diff to previous 1.76 (colored)

o use mode_t, not int for permissions.
o use strtol() instead of sscanf() to parse numbers in config file
This has been sitting in my tree for a long time...

Revision 1.76 / (download) - annotate - [select for diffs], Tue Dec 16 19:32:45 2003 UTC (20 years, 5 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.75: +5 -5 lines
Diff to previous 1.75 (colored)

Avoid segmentation fault when empty commands are specified in the
config file; resolves PR 3578.

ok deraadt@ millert@

Revision 1.75 / (download) - annotate - [select for diffs], Fri Jul 25 10:28:53 2003 UTC (20 years, 9 months ago) by mpech
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.74: +3 -3 lines
Diff to previous 1.74 (colored)

When parser_file() fails, print correct line number.

millert@ ok

Revision 1.74 / (download) - annotate - [select for diffs], Tue Jul 1 23:43:12 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.73: +72 -26 lines
Diff to previous 1.73 (colored)

Add support for -a dirs on different filesystems.
From FreeBSD via S. Deinhard.

Revision 1.73 / (download) - annotate - [select for diffs], Thu Jun 26 21:59:10 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.72: +6 -4 lines
Diff to previous 1.72 (colored)

more proto fixes

Revision 1.72 / (download) - annotate - [select for diffs], Tue Jun 17 21:56:25 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.71: +12 -9 lines
Diff to previous 1.71 (colored)

Sync with share/misc/license.template and add missing DARPA credit
where applicable.

Revision 1.71 / (download) - annotate - [select for diffs], Tue Jun 10 22:58:45 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.70: +3 -3 lines
Diff to previous 1.70 (colored)

Whoops, <= 0 should be < 0.  Problem noticed by marc@

Revision 1.70 / (download) - annotate - [select for diffs], Mon Jun 9 20:43:44 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.69: +28 -28 lines
Diff to previous 1.69 (colored)

o replace remaining strtoul() with strtol() and check for < 0
o use %lld, not %qd in printf and scanf
o fix some whitespace issues

Revision 1.69 / (download) - annotate - [select for diffs], Mon Jun 9 20:29:10 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.68: +8 -8 lines
Diff to previous 1.68 (colored)

Use strtol() not strtoul() so we can detect a negative number in a pid file.

Revision 1.68 / (download) - annotate - [select for diffs], Mon Jun 9 20:21:36 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.67: +3 -2 lines
Diff to previous 1.67 (colored)

Need to include time.h to get ctime() proto.

Revision 1.67 / (download) - annotate - [select for diffs], Tue Jun 3 21:09:02 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.66: +2 -9 lines
Diff to previous 1.66 (colored)

terms 3 & 4 cleanup based on "terms" file

Revision 1.66 / (download) - annotate - [select for diffs], Tue Jun 3 01:52:41 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.65: +13 -24 lines
Diff to previous 1.65 (colored)

Use an ISC-tyle license for all my code; it is simpler and more permissive.

Revision 1.65 / (download) - annotate - [select for diffs], Thu May 15 03:25:02 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.64: +13 -13 lines
Diff to previous 1.64 (colored)

From Brian Poole
o fix typos
o remove a redundant check for verbose

Revision 1.64 / (download) - annotate - [select for diffs], Fri Apr 25 20:07:09 2003 UTC (21 years ago) by pvalchev
Branch: MAIN
Changes since 1.63: +3 -4 lines
Diff to previous 1.63 (colored)

check asprintf return value for error, as the pointer is not guaranteed
to be NULL in such case; ok millert

Revision 1.63 / (download) - annotate - [select for diffs], Wed Feb 12 19:17:36 2003 UTC (21 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.62: +246 -9 lines
Diff to previous 1.62 (colored)

Add support for rotating files at a specific time; from FreeBSD

Revision 1.62 / (download) - annotate - [select for diffs], Sat Jan 25 05:16:50 2003 UTC (21 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.61: +3 -3 lines
Diff to previous 1.61 (colored)

it is 2003 now

Revision 1.61 / (download) - annotate - [select for diffs], Sat Jan 25 05:13:02 2003 UTC (21 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.60: +35 -27 lines
Diff to previous 1.60 (colored)

Move parsing of the monitor notification user with the rest of the
optional arguments and add some sanity checking (if the M flag is
specified a notification user must be specified as well).
Also make the -n flag work in conjunction with -m and make verbose
mode more monitor-friendly.  deraadt@ OK

Revision 1.60 / (download) - annotate - [select for diffs], Mon Dec 23 00:09:52 2002 UTC (21 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.59: +35 -25 lines
Diff to previous 1.59 (colored)

Display offending line number in error messages.
Based on a patch from Sam Smith.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Nov 27 22:56:16 2002 UTC (21 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.58: +4 -4 lines
Diff to previous 1.58 (colored)

typo; Tor Houghton

Revision 1.57.2.1 / (download) - annotate - [select for diffs], Fri Nov 15 19:16:29 2002 UTC (21 years, 6 months ago) by millert
Branch: OPENBSD_3_2
Changes since 1.57: +17 -10 lines
Diff to previous 1.57 (colored) next main 1.58 (colored)

Pull in a fix from -current:
Sizes are in KB, not bytes, which made the cutoff size for
rotating a file 512KB instead of 512 bytes, as was intended.  Change
things to deal in bytes internally and drop the cutoff to 256 bytes.

Revision 1.58 / (download) - annotate - [select for diffs], Thu Nov 7 15:25:13 2002 UTC (21 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.57: +17 -10 lines
Diff to previous 1.57 (colored)

Sigh, sizes are in KB, not bytes, which made the cutoff size for
rotating a file 512KB instead of 512 bytes, as was intended.  Change
things to deal in bytes internally and drop the cutoff to 256 bytes.

Revision 1.57 / (download) - annotate - [select for diffs], Sat Sep 21 23:19:43 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE
Branch point for: OPENBSD_3_2
Changes since 1.56: +78 -36 lines
Diff to previous 1.56 (colored)

When rotating files or checking the age of a file, check for both
compressed and uncompressed logs but consult the flags to see which
we one prefer should both exist.  This keeps things from getting
hosed if someone compresses or uncompresses one of the archived log files.

Revision 1.56 / (download) - annotate - [select for diffs], Thu Sep 19 21:22:59 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.55: +13 -9 lines
Diff to previous 1.55 (colored)

Deal with someone specifying an empty string for the command to run
and make it mean "send no signal and run no command".

Revision 1.55 / (download) - annotate - [select for diffs], Thu Sep 19 20:58:50 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.54: +9 -5 lines
Diff to previous 1.54 (colored)

Fix long-standing bug.  When specifying a command to run instead of sending
a signal, the command was never actually run.

Revision 1.54 / (download) - annotate - [select for diffs], Thu Sep 19 15:27:31 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.53: +3 -3 lines
Diff to previous 1.53 (colored)

Since isspace() considers \n to be a space we need to check for start
of line == \0, not \n after stripping leading blanks.  Otherwise blank
lines give an error.  Noticed by marc@

Revision 1.53 / (download) - annotate - [select for diffs], Tue Sep 17 20:44:38 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.52: +37 -9 lines
Diff to previous 1.52 (colored)

Allow user to restrict logs to be rotated by specifying pathnames on
the command line.  The default is to rotate all files in newsyslog.conf

Revision 1.52 / (download) - annotate - [select for diffs], Tue Sep 17 20:16:43 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.51: +22 -14 lines
Diff to previous 1.51 (colored)

Add -F (force) flag; inspired by FreeBSD

Revision 1.51 / (download) - annotate - [select for diffs], Tue Sep 17 20:03:40 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.50: +117 -65 lines
Diff to previous 1.50 (colored)

Add -a flag to specify a directory to store archived logs.  Based on
changes I made years ago to a private version of newsyslog but with
the option renamed to match FreeBSD.  Note that unlike the FreeBSD
-a flag, we don't automagically create the archive dir if it doesn't exist.
OK deraadt@ and todd@

Revision 1.50 / (download) - annotate - [select for diffs], Mon Sep 16 01:41:54 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.49: +66 -63 lines
Diff to previous 1.49 (colored)

o Remove "NONE" #define and check uid_t and gid_t against -1 with proper casts
o Don't call chown/fchown if neither uid nor gid was specified
o Fix check for symlinks in non-verbose mode
o Add DPRINTF macro to simplify code in verbose mode
o Print B and F flags in -v and -n modes
o Add a leading tab to lines printed in -n mode for clarity

Revision 1.49 / (download) - annotate - [select for diffs], Fri Sep 13 18:50:09 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.48: +8 -6 lines
Diff to previous 1.48 (colored)

Don't rotate log files < 512 bytes unless in binary mode.  This
prevents newsyslog from rotating a file that only contains the
messages that the log file was turned over.  deraadt@ OK

Revision 1.48 / (download) - annotate - [select for diffs], Fri Sep 13 00:16:13 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.47: +90 -132 lines
Diff to previous 1.47 (colored)

KNF + ANSI; deraadt@ OK

Revision 1.47 / (download) - annotate - [select for diffs], Thu Sep 12 19:58:38 2002 UTC (21 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.46: +5 -4 lines
Diff to previous 1.46 (colored)

add missing include of limits.h

Revision 1.46 / (download) - annotate - [select for diffs], Mon Aug 12 00:42:56 2002 UTC (21 years, 9 months ago) by aaron
Branch: MAIN
Changes since 1.45: +3 -3 lines
Diff to previous 1.45 (colored)

Swap args to calloc(3) so they are in the correct order; art@ ok.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Jun 26 23:36:14 2002 UTC (21 years, 10 months ago) by wcobb
Branch: MAIN
Changes since 1.44: +20 -2 lines
Diff to previous 1.44 (colored)

Don't follow symbolic links for (ie. user-owned) log files by default;
closes pr #1913.

ok millert@

Revision 1.44 / (download) - annotate - [select for diffs], Wed Jun 12 06:07:16 2002 UTC (21 years, 11 months ago) by mpech
Branch: MAIN
Changes since 1.43: +5 -5 lines
Diff to previous 1.43 (colored)

a real pid_t cleanup.

espie@ ok for make/,
deraadt@ one extra eye,
millert@ ok

Revision 1.43 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:50 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.42: +21 -21 lines
Diff to previous 1.42 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.42 / (download) - annotate - [select for diffs], Tue Nov 27 18:17:38 2001 UTC (22 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.41: +9 -3 lines
Diff to previous 1.41 (colored)

Fix uninitialized variable introduced in rev 1.40; found by lebel@
If fgets() fails, set err to a reasonable value.  Otherwise we
could send the signal to pid 0 which would be bad...

Revision 1.41 / (download) - annotate - [select for diffs], Sat Nov 24 19:53:22 2001 UTC (22 years, 5 months ago) by marc
Branch: MAIN
Changes since 1.40: +3 -3 lines
Diff to previous 1.40 (colored)

handle NL terminated pid files correctly, OK deraadt@

Revision 1.40 / (download) - annotate - [select for diffs], Fri Nov 23 04:20:56 2001 UTC (22 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.39: +31 -18 lines
Diff to previous 1.39 (colored)

greater care at reading pidfiles; millert ok

Revision 1.39 / (download) - annotate - [select for diffs], Mon Nov 19 19:02:15 2001 UTC (22 years, 6 months ago) by mpech
Branch: MAIN
Changes since 1.38: +4 -4 lines
Diff to previous 1.38 (colored)

kill more registers

millert@ ok

Revision 1.38 / (download) - annotate - [select for diffs], Fri Nov 16 23:49:07 2001 UTC (22 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.37: +5 -2 lines
Diff to previous 1.37 (colored)

errno safety in SIGCHLD handler

Revision 1.37 / (download) - annotate - [select for diffs], Mon Jul 9 07:04:50 2001 UTC (22 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.36: +3 -3 lines
Diff to previous 1.36 (colored)

correct type on last arg to execl(); nordin@cse.ogi.edu

Revision 1.36 / (download) - annotate - [select for diffs], Thu Mar 1 20:34:10 2001 UTC (23 years, 2 months ago) by aaron
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.35: +4 -4 lines
Diff to previous 1.35 (colored)

Remove -t option from getopt() since it doesn't exist; mpech@prosoft.org.lv.
Also rearrage options in the man page while I'm here.

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jan 12 16:24:06 2001 UTC (23 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +263 -264 lines
Diff to previous 1.34 (colored)

various small cleanups

Revision 1.30.2.2 / (download) - annotate - [select for diffs], Fri Oct 6 21:16:16 2000 UTC (23 years, 7 months ago) by jason
Branch: OPENBSD_2_7
Changes since 1.30.2.1: +5 -5 lines
Diff to previous 1.30.2.1 (colored) to branchpoint 1.30 (colored) next main 1.31 (colored)

Pull in patch from current (even more to come):
Fix (millert):
warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant).  These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jun 30 16:00:19 2000 UTC (23 years, 10 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.33: +5 -5 lines
Diff to previous 1.33 (colored)

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant).  These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jun 14 22:55:19 2000 UTC (23 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.32: +6 -6 lines
Diff to previous 1.32 (colored)

monitor -> monitormode because some OSes have a monitor(3)

Revision 1.32 / (download) - annotate - [select for diffs], Mon Jun 12 17:41:21 2000 UTC (23 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.31: +28 -15 lines
Diff to previous 1.31 (colored)

Make the flags field truly optional.

Revision 1.30.2.1 / (download) - annotate - [select for diffs], Sat Jun 10 20:26:02 2000 UTC (23 years, 11 months ago) by jason
Branch: OPENBSD_2_7
Changes since 1.30: +3 -2 lines
Diff to previous 1.30 (colored)

Pull in patch from current:
Fix (millert):
Increment pl when filling in pidlist.  It was just overwriting the first
entry each time.  Unless you have multiple pid files you don't notice
which is why this slipped through the cracks.  Noted by Jonathan Rozes.

Revision 1.31 / (download) - annotate - [select for diffs], Sat Jun 10 02:49:41 2000 UTC (23 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.30: +3 -2 lines
Diff to previous 1.30 (colored)

Increment pl when filling in pidlist.  It was just overwriting the first
entry each time.  Unless you have multiple pid files you don't notice
which is why this slipped through the cracks.  Noted by Jonathan Rozes.

Revision 1.30 / (download) - annotate - [select for diffs], Thu Nov 11 22:24:14 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE
Branch point for: OPENBSD_2_7
Changes since 1.29: +114 -27 lines
Diff to previous 1.29 (colored)

Add support for sending signals other than SIGHUP and optionally
run a command instead of sending a signal.

Revision 1.29 / (download) - annotate - [select for diffs], Tue Nov 9 03:28:41 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.28: +3 -3 lines
Diff to previous 1.28 (colored)

calloc an array of char *, not pid_t (left over from previous implementation).

Revision 1.28 / (download) - annotate - [select for diffs], Tue Nov 9 03:03:27 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.27: +32 -13 lines
Diff to previous 1.27 (colored)

Avoid sending a HUP to a process multiple times.  Ie: instead of one
per log file, do one per pid file (but only if the pid file corresponds
to a log file that was rotated).

Revision 1.27 / (download) - annotate - [select for diffs], Sun Nov 7 05:31:53 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.26: +12 -3 lines
Diff to previous 1.26 (colored)

compress_log() now needs to check for noaction != 0

Revision 1.26 / (download) - annotate - [select for diffs], Sun Nov 7 05:16:28 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.25: +81 -54 lines
Diff to previous 1.25 (colored)

Don't send a HUP or compress the log files until _everything_ has been
rotated.  Fixes a race condition between syslogd and newsyslog whereby
syslogd could be reinitializing (due to SIGHUP) while newsyslog was
rotating the next log file.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Nov 7 03:59:12 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.24: +175 -145 lines
Diff to previous 1.24 (colored)

o Some KNF + consistent indentation for readability
o When pid file cannot be opened give a sensible warning
o Use fchmod when we can
o Check more return values
o Use uid_t/gid_t when sensible
o When computing kbytes from blocks do so in such a way that is not likely
to cause wrap.
o Sanity check path lengths to avoid chance of oflow

Revision 1.24 / (download) - annotate - [select for diffs], Sat Nov 6 21:02:05 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.23: +8 -12 lines
Diff to previous 1.23 (colored)

Back out version 1.21 since it breaks age rotation.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Nov 6 20:46:31 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

back out unwanted private change

Revision 1.22 / (download) - annotate - [select for diffs], Sat Nov 6 20:45:26 1999 UTC (24 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.21: +8 -10 lines
Diff to previous 1.21 (colored)

Use fchmod instead of chmod and open() instead of creat().

Revision 1.21 / (download) - annotate - [select for diffs], Wed Oct 13 17:24:23 1999 UTC (24 years, 7 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.20: +9 -6 lines
Diff to previous 1.20 (colored)

age_old_log() now takes an int * as a parameter so it can return -1
on failure w/o the caller thinking the difference in mtime is -1.
Just set modtime to 0 in this case in the caller which effectively
ignores it.  This fixes a problem where if there was now foo.0 file
newsyslog would rotate an empty file.

Revision 1.20 / (download) - annotate - [select for diffs], Fri Aug 27 08:49:29 1999 UTC (24 years, 8 months ago) by fgsch
Branch: MAIN
Changes since 1.19: +4 -4 lines
Diff to previous 1.19 (colored)

Replace some strlen with sizeof() - 1.
Don't forget to malloc space for newline.
Suggested by aazubel@cnba.uba.ar; ok millert@

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jun 8 15:42:54 1999 UTC (24 years, 11 months ago) by kstailey
Branch: MAIN
Changes since 1.18: +8 -16 lines
Diff to previous 1.18 (colored)

fewer strings

Revision 1.18 / (download) - annotate - [select for diffs], Mon Mar 8 03:16:34 1999 UTC (25 years, 2 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

numlogs cannot be negative; karls@inet.no

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jan 5 00:43:44 1999 UTC (25 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.16: +11 -12 lines
Diff to previous 1.16 (colored)

do not concern ourselves with MAX_PID

Revision 1.16 / (download) - annotate - [select for diffs], Mon Jan 4 19:24:17 1999 UTC (25 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.15: +22 -5 lines
Diff to previous 1.15 (colored)

MIN_PID should be 4 since update is proc 3 now

Revision 1.15 / (download) - annotate - [select for diffs], Mon Dec 28 06:28:15 1998 UTC (25 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (colored)

crank PID_MAX to 99999

Revision 1.14 / (download) - annotate - [select for diffs], Thu Sep 24 03:36:58 1998 UTC (25 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.13: +36 -26 lines
Diff to previous 1.13 (colored)

Add optional support for pid files other than /var/run/syslog.pid
Useful for rotating httpd logs.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Apr 25 18:12:58 1998 UTC (26 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.12: +5 -5 lines
Diff to previous 1.12 (colored)

be more verbose on errors.
one typo in fchown error msg

Revision 1.12 / (download) - annotate - [select for diffs], Thu Jul 10 17:37:10 1997 UTC (26 years, 10 months ago) by kstailey
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.11: +4 -4 lines
Diff to previous 1.11 (colored)

NULL

Revision 1.11 / (download) - annotate - [select for diffs], Tue Jul 8 04:26:00 1997 UTC (26 years, 10 months ago) by downsj
Branch: MAIN
Changes since 1.10: +62 -129 lines
Diff to previous 1.10 (colored)

err()/warn()

Revision 1.10 / (download) - annotate - [select for diffs], Mon Jul 7 22:50:56 1997 UTC (26 years, 10 months ago) by downsj
Branch: MAIN
Changes since 1.9: +236 -12 lines
Diff to previous 1.9 (colored)

Add rudimentary logfile monitoring capabilities; enable by placing an 'M'
in the flags field, followed by the username to be notified in an additional
(optional, based on the presence of 'M' in flags) field.

Man page to follow...

Revision 1.9 / (download) - annotate - [select for diffs], Sun Apr 27 13:48:55 1997 UTC (27 years ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.8: +37 -56 lines
Diff to previous 1.8 (colored)

Prototype fixes and cruft removal.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Jan 15 23:42:56 1997 UTC (27 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

getopt(3) returns -1 when out of args, not EOF, whee!

Revision 1.7 / (download) - annotate - [select for diffs], Sat Dec 7 08:00:45 1996 UTC (27 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +7 -7 lines
Diff to previous 1.6 (colored)

increase buf sizes, hacked w/ bitblt

Revision 1.6 / (download) - annotate - [select for diffs], Mon Sep 2 18:47:16 1996 UTC (27 years, 8 months ago) by tholo
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.5: +4 -3 lines
Diff to previous 1.5 (colored)

Save the log file if the original number of days was > 0; don't rely on
being able to use numdays after aging the existing logfiles

Revision 1.5 / (download) - annotate - [select for diffs], Sat Aug 31 14:20:36 1996 UTC (27 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +14 -6 lines
Diff to previous 1.4 (colored)

do ngen == 0 correctly; netbsd pr#2724; kstailey@dol-esa.gov

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jul 22 10:09:17 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +2 -4 lines
Diff to previous 1.3 (colored)

rcsid cleanup

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 26 05:37:29 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +3 -1 lines
Diff to previous 1.2 (colored)

rcsid

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jan 7 07:36:11 1996 UTC (28 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +4 -4 lines
Diff to previous 1.1 (colored)

date formatting glitch; from kashmir@umiacs.UMD.EDU; netbsd pr#1906

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:45:51 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:45:51 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.