X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fcfg.c;h=d0170b60e720fd00f5e78721c60c1b8c00fe644a;hb=e8cf6733e490cf78c1e5f5f58c3655011fb8ae22;hp=433d7a0fac56ba6cb47e402fe573ed909941e8ed;hpb=867fb42cba19c25cfbe4f6752ebd3e44c29be2a1;p=openvswitch diff --git a/lib/cfg.c b/lib/cfg.c index 433d7a0f..d0170b60 100644 --- a/lib/cfg.c +++ b/lib/cfg.c @@ -92,6 +92,12 @@ static bool is_type(const char *s, enum cfg_flags); #define CC_FILE_NAME CC_ALNUM "._-" #define CC_KEY CC_ALNUM "._-@$:+" +void +cfg_init(void) +{ + svec_terminate(&cfg); +} + /* Sets 'file_name' as the configuration file read by cfg_read(). Returns 0 on * success, otherwise a positive errno value if 'file_name' cannot be opened. * @@ -130,7 +136,7 @@ cfg_set_file(const char *file_name) slash = strrchr(file_name, '/'); if (slash) { lock_name = xasprintf("%.*s/.%s.~lock~", - slash - file_name, file_name, slash + 1); + (int) (slash - file_name), file_name, slash + 1); } else { lock_name = xasprintf(".%s.~lock~", file_name); } @@ -183,6 +189,7 @@ cfg_read(void) file = fopen(cfg_name, "r"); if (!file) { VLOG_ERR("failed to open \"%s\": %s", cfg_name, strerror(errno)); + svec_terminate(&cfg); return errno; }