Fix validation of the previous cloud-instance

This commit is contained in:
Reyk Floeter 2017-06-29 13:34:19 +02:00
parent 2b1181c2ca
commit db607f0e55

View file

@ -419,10 +419,12 @@ agent_configure(struct system_config *sc, int noaction)
char *str1, *str2;
/* Skip configuration on the same instance */
if ((str1 = filein("r", "/var/db/cloud-instance")) != NULL &&
strcmp(sc->sc_instance, str1) == 0) {
free(str1);
return (0);
if ((str1 = filein("r", "/var/db/cloud-instance")) != NULL) {
str1[strcspn(str1, "\r\n")] = '\0';
if (strcmp(sc->sc_instance, str1) == 0) {
free(str1);
return (0);
}
}
free(str1);