Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

OS-1605 vrrpadm dies when its configuration file doesn't exist

  • Loading branch information...
commit bff0549ecc55150732f97b1200854000e5727e73 1 parent cc29f9a
@rgulewich rgulewich authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 usr/src/cmd/cmd-inet/usr.lib/vrrpd/vrrpd.c
View
16 usr/src/cmd/cmd-inet/usr.lib/vrrpd/vrrpd.c
@@ -2007,9 +2007,19 @@ vrrpd_updateconf(vrrp_vr_conf_t *newconf, uint_t op)
op == VRRP_CONF_UPDATE ? "update" : "delete");
if ((fp = fopen(vrrpd_conffile, "r+F")) == NULL) {
- vrrp_log(VRRP_ERR, "vrrpd_updateconf(): open %s failed: %s",
- vrrpd_conffile, strerror(errno));
- return (VRRP_EDB);
+ if (errno != ENOENT) {
+ vrrp_log(VRRP_ERR, "vrrpd_updateconf(): open %s for "
+ "update failed: %s", vrrpd_conffile,
+ strerror(errno));
+ return (VRRP_EDB);
+ }
+
+ if ((fp = fopen(vrrpd_conffile, "w+F")) == NULL) {
+ vrrp_log(VRRP_ERR, "vrrpd_updateconf(): open %s for "
+ "write failed: %s", vrrpd_conffile,
+ strerror(errno));
+ return (VRRP_EDB);
+ }
}
(void) snprintf(newfile, MAXPATHLEN, "%s.new", vrrpd_conffile);
Please sign in to comment.
Something went wrong with that request. Please try again.