Red Hat Bugzilla – Bug 126490
Pre- and postrotate scripts don't pass logfile name in arg1
Last modified: 2007-11-30 17:10:45 EST
Description of problem:
In old logrotate 3.6 a prerotate or postrotate script called with the logfile name in the first
argument. Now no argument is passed to scripts.
Version-Release number of selected component (if applicable):
The bug is in execlp(3) call. In 3.6 there was a system(3) call, which handled everything
well. Now execlp() is called as execlp(filespec, logfn, NULL);, but execlp(3) man page says:
int execlp( const char *file, const char *arg, ...);
The const char *arg and subsequent ellipses in the execl, execlp, and execle
functions can be
thought of as arg0, arg1, ..., argn. Together they describe a list of one or more
thus the first parameter (file) is filespec, arg0 is logfn (==the file is run as this name), and
there're no arguments. This line should be replaced by execlp(filespec, filespec, logfn,
NULL);, or - much better - as described in bug 126259 (of course with a good arg0).
Fixed in CVS. Thanks!
*** Bug 129551 has been marked as a duplicate of this bug. ***