Commit f72acd55 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(configure_line): Allow empty values.

(assign_text_no, assign_conf_no, assign_int): Sanity check the
argument.
parent b2d3244b
/*
* $Id: conf-file.c,v 1.6 1994/03/08 22:57:03 ceder Exp $
* $Id: conf-file.c,v 1.7 1995/09/05 19:17:16 ceder Exp $
* Copyright (C) 1994 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -26,7 +26,7 @@
* Read configuration files.
*/
static char *rcsid = "$Id: conf-file.c,v 1.6 1994/03/08 22:57:03 ceder Exp $";
static char *rcsid = "$Id: conf-file.c,v 1.7 1995/09/05 19:17:16 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -34,6 +34,7 @@ USE(rcsid);
#include <sys/types.h>
#include <time.h>
#include <assert.h>
#include <ctype.h>
#ifdef HAVE_STRING_H
# include <string.h>
#else
......@@ -154,10 +155,6 @@ configure_line(FILE *fp,
;
switch (*val)
{
case '\n':
log ("empty value: %s\n", line);
(*err)++;
return 0;
case '\0':
log ("line too long (max %d chars allowed): %s\n", MAXLINE-1, line);
(*err)++;
......@@ -238,7 +235,11 @@ assign_text_no(const char *val,
const struct parameter *par)
{
if (val != NULL)
{
if (!isdigit(*val))
return FAILURE;
*(Text_no*)par->value = atol(val);
}
return OK;
}
......@@ -247,7 +248,11 @@ assign_conf_no(const char *val,
const struct parameter *par)
{
if (val != NULL)
{
if (!isdigit(*val))
return FAILURE;
*(Conf_no*)par->value = atol(val);
}
return OK;
}
......@@ -256,7 +261,11 @@ assign_int(const char *val,
const struct parameter *par)
{
if (val != NULL)
{
if (!isdigit(*val) && *val != '-')
return FAILURE;
*(int*)par->value = atol(val);
}
return OK;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment