If fstat() failes logrotate() cannot run, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
1fe3c311ca
commit
2e8dffe893
@ -1461,7 +1461,9 @@ void logrotate(struct filed *f)
|
|||||||
if (!f->f_rotatesz)
|
if (!f->f_rotatesz)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fstat(f->f_file, &statf);
|
if (fstat(f->f_file, &statf))
|
||||||
|
return;
|
||||||
|
|
||||||
/* bug (mostly harmless): can wrap around if file > 4gb */
|
/* bug (mostly harmless): can wrap around if file > 4gb */
|
||||||
if (S_ISREG(statf.st_mode) && statf.st_size > f->f_rotatesz) {
|
if (S_ISREG(statf.st_mode) && statf.st_size > f->f_rotatesz) {
|
||||||
if (f->f_rotatecount > 0) { /* always 0..999 */
|
if (f->f_rotatecount > 0) { /* always 0..999 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user