mirror of
https://github.com/3cky/mbusd.git
synced 2025-01-29 22:11:34 +01:00
Zero length of log file name interpreted as no log file needed
This commit is contained in:
parent
ed2e49c9dc
commit
07c98cc84e
14
src/log.c
14
src/log.c
@ -28,7 +28,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.c,v 1.3 2003/10/10 20:44:06 kapyar Exp $
|
||||
* $Id: log.c,v 1.4 2003/10/26 19:26:08 kapyar Exp $
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
@ -46,13 +46,21 @@ log_init(char *logname)
|
||||
int maxlen = INTBUFSIZE;
|
||||
|
||||
/* checking log file name */
|
||||
if (*logname != '/')
|
||||
if (*logname == '/')
|
||||
strncpy(logfullname, logname, maxlen);
|
||||
else
|
||||
{
|
||||
if (!*logname)
|
||||
{
|
||||
/* logfile isn't needed */
|
||||
*logfullname = '\0';
|
||||
return RC_OK;
|
||||
}
|
||||
/* append default log path */
|
||||
strncpy(logfullname, LOGPATH, maxlen);
|
||||
maxlen -= strlen(logfullname);
|
||||
strncat(logfullname, logname, maxlen);
|
||||
}
|
||||
else strncpy(logfullname, logname, maxlen);
|
||||
|
||||
logfile = fopen(logfullname, "at");
|
||||
if (logfile)
|
||||
|
Loading…
Reference in New Issue
Block a user