aboutsummaryrefslogtreecommitdiffstats
path: root/rcfile_y.y
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-05-13 08:22:11 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-05-13 08:22:11 +0000
commit01cd94b5228ce4f13383212f1e83a758a1c2e9ff (patch)
treecb924576d4919422a640a8741ba689d6d10a9107 /rcfile_y.y
parent8af9f33de0858698daba73aebab4b6dc3279a231 (diff)
downloadfetchmail-01cd94b5228ce4f13383212f1e83a758a1c2e9ff.tar.gz
fetchmail-01cd94b5228ce4f13383212f1e83a758a1c2e9ff.tar.bz2
fetchmail-01cd94b5228ce4f13383212f1e83a758a1c2e9ff.zip
Defensive programming in case lexer passes a blank string or null.
svn path=/trunk/; revision=990
Diffstat (limited to 'rcfile_y.y')
-rw-r--r--rcfile_y.y10
1 files changed, 6 insertions, 4 deletions
diff --git a/rcfile_y.y b/rcfile_y.y
index 2b5bd871..d6266d4d 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -240,7 +240,8 @@ static struct query *hosttail; /* where to add new elements */
void yyerror (const char *s)
/* report a syntax error */
{
- error_at_line( 0, 0, rcfile, prc_lineno, "%s at %s", s, yytext );
+ error_at_line( 0, 0, rcfile, prc_lineno, "%s at %s", s,
+ (yytext && yytext[0]) ? yytext : "end of input");
prc_errflag++;
}
@@ -250,15 +251,16 @@ const char *pathname; /* pathname for the configuration file */
{
struct stat statbuf;
- /* special case, useful for debugging purposes */
- if (strcmp("/dev/null", pathname) == 0)
+ errno = 0;
+
+ /* special cases useful for debugging purposes */
+ if (strcmp("/dev/null", pathname) == 0 || versioninfo)
return(0);
/* the run control file must have the same uid as the REAL uid of this
process, it must have permissions no greater than 600, and it must not
be a symbolic link. We check these conditions here. */
- errno = 0;
if (lstat(pathname, &statbuf) < 0) {
if (errno == ENOENT)
return(0);