- case hf_none:
- /* do nothing */
- break;
-
- case hf_hostname:
- status = snprintf (host_ptr, host_len, ":%s", hostname_g);
- break;
-
- case hf_name:
- {
- const char *name = virDomainGetName (dom);
- if (name != NULL)
- status = snprintf (host_ptr, host_len, ":%s", name);
- break;
- }
- case hf_uuid:
- {
- char uuid[VIR_UUID_STRING_BUFLEN];
- if (virDomainGetUUIDString (dom, uuid) == 0) {
- uuid[sizeof (uuid) - 1] = '\0';
- status = snprintf (host_ptr, host_len, ":%s", uuid);
- }
- break;
- }
- } /* switch (hostname_format[i]) */
-
- /* If status >= host_len
- * => the buffer is full, there's no null-byte at the end and
- * continuing with this loop doesn't make any sense. */
- if (status >= host_len) {
- host_len = 0;
- host_ptr = NULL;
- }
- /* else: Test if anything was added to the buffer */
- else if (status > 0) {
- host_len -= status;
- host_ptr += status;
- }
-
- if (host_len <= 0)
- break;
- } /* for (i) */
+ case hf_none: break;
+ case hf_hostname:
+ strncat (vl->host, hostname_g, n);
+ break;
+ case hf_name:
+ name = virDomainGetName (dom);
+ if (name)
+ strncat (vl->host, name, n);
+ break;
+ case hf_uuid:
+ if (virDomainGetUUIDString (dom, uuid) == 0)
+ strncat (vl->host, uuid, n);
+ break;
+ }
+ }