Discussion:
`ifstated -n' more useful error message
Michael Reed
2016-01-29 01:59:16 UTC
Permalink
If fopen("/etc/ifstated.conf", ...) fails for whatever reason the
error message isn't very helpful:

$ ifstated -n
ifstated: /etc/ifstated.conf

With this patch:

$ ./ifstated -n
ifstated: /etc/ifstated.conf: No such file or directory



Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/ifstated/parse.y,v
retrieving revision 1.36
diff -u -p -r1.36 parse.y
--- parse.y 20 Nov 2014 05:51:20 -0000 1.36
+++ parse.y 29 Jan 2016 01:56:31 -0000
@@ -685,7 +685,7 @@ pushfile(const char *name, int secret)
return (NULL);
}
if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
- warnx("%s", nfile->name);
+ warn("%s", nfile->name);
free(nfile->name);
free(nfile);
return (NULL);
Michael McConville
2016-01-29 02:24:10 UTC
Permalink
Post by Michael Reed
If fopen("/etc/ifstated.conf", ...) fails for whatever reason the
$ ifstated -n
ifstated: /etc/ifstated.conf
$ ./ifstated -n
ifstated: /etc/ifstated.conf: No such file or directory
Committed. Thanks!
Post by Michael Reed
errx(1, "parse_config malloc");
err(1, NULL);
Loading...