Build errors from gcc 6:
cachemgr.c: In function 'main': cachemgr.c:471:3: error: this 'if' clause does not guard... [-Werror=misleading-indentation] if (strlen(current_admin.logfile) == 0) ^~ cachemgr.c:473:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' (void) cachemgr_set_lf(¤t_admin, ^ cc1: all warnings being treated as errors
The current_admin is global structure with logfile defined as fixed length string, so the current_ admin is initially zeroed out; this else block is setting the log file and just before calling the cachemgr_set_lf() to set log file, the code is making sure the current_admin.logfile has the actual file name.
The /dev/null is set for log file only in case the ldapcachemgr was not started with -l, meaning the else block was meant to set log file, either to one specified with -l or /dev/null.
Updated by Electric Monk about 5 years ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
commit eb28af623974cfc31cb4545d2965bbaca3fb6888 Author: Toomas Soome <email@example.com> Date: 2017-06-19T17:08:40.000Z 8329 ldapcachemgr: misleading-indentation 8364 ldapcachemgr does not set log file in debug mode if -l was not used Reviewed by: Jason King <firstname.lastname@example.org> Reviewed by: Robert Mustacchi <email@example.com> Reviewed by: Yuri Pankov <firstname.lastname@example.org> Approved by: Richard Lowe <email@example.com>