From: Claudio Jeker Subject: bgpd: use const for conffile To: tech@openbsd.org Date: Wed, 12 Feb 2025 17:51:57 +0100 Lets use a bit more const for the conffile. The data conffile points to is most probably read-only. -- :wq Claudio Index: bgpd.c =================================================================== RCS file: /cvs/src/usr.sbin/bgpd/bgpd.c,v diff -u -p -r1.280 bgpd.c --- bgpd.c 3 Dec 2024 13:46:53 -0000 1.280 +++ bgpd.c 12 Feb 2025 16:50:10 -0000 @@ -46,7 +46,7 @@ __dead void usage(void); int main(int, char *[]); pid_t start_child(enum bgpd_process, char *, int, int, int); int send_filterset(struct imsgbuf *, struct filter_set_head *); -int reconfigure(char *, struct bgpd_config *); +int reconfigure(const char *, struct bgpd_config *); int send_config(struct bgpd_config *); int dispatch_imsg(struct imsgbuf *, int, struct bgpd_config *); int control_setup(struct bgpd_config *); @@ -133,7 +133,7 @@ main(int argc, char *argv[]) struct connect_elm *ce; time_t timeout; pid_t se_pid = 0, rde_pid = 0, rtr_pid = 0, pid; - char *conffile; + const char *conffile; char *saved_argv0; u_int pfd_elms = 0, npfd, i; int debug = 0; @@ -572,7 +572,7 @@ send_filterset(struct imsgbuf *i, struct } int -reconfigure(char *conffile, struct bgpd_config *conf) +reconfigure(const char *conffile, struct bgpd_config *conf) { struct bgpd_config *new_conf; Index: bgpd.h =================================================================== RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v diff -u -p -r1.513 bgpd.h --- bgpd.h 12 Feb 2025 16:40:51 -0000 1.513 +++ bgpd.h 12 Feb 2025 16:50:10 -0000 @@ -1544,7 +1544,7 @@ uint16_t pftable_ref(uint16_t); /* parse.y */ int cmdline_symset(char *); struct prefixset *find_prefixset(char *, struct prefixset_head *); -struct bgpd_config *parse_config(char *, struct peer_head *, +struct bgpd_config *parse_config(const char *, struct peer_head *, struct rtr_config_head *); /* pftable.c */ Index: parse.y =================================================================== RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v diff -u -p -r1.479 parse.y --- parse.y 4 Feb 2025 18:16:56 -0000 1.479 +++ parse.y 12 Feb 2025 16:50:11 -0000 @@ -4099,7 +4099,8 @@ init_config(struct bgpd_config *c) } struct bgpd_config * -parse_config(char *filename, struct peer_head *ph, struct rtr_config_head *rh) +parse_config(const char *filename, struct peer_head *ph, + struct rtr_config_head *rh) { struct sym *sym, *next; struct rde_rib *rr;