struct blkid_prval *v;
int i;
+ if (len > BLKID_PROBVAL_BUFSIZ)
+ len = BLKID_PROBVAL_BUFSIZ;
+
if ((pr->probreq & BLKID_PROBREQ_LABELRAW) &&
blkid_probe_set_value(pr, "LABEL_RAW", label, len) < 0)
return -1;
int blkid_probe_sprintf_uuid(blkid_probe pr, unsigned char *uuid,
size_t len, const char *fmt, ...)
{
+ int rc = -1;
va_list ap;
- int rc;
+
+ if (len > BLKID_PROBVAL_BUFSIZ)
+ len = BLKID_PROBVAL_BUFSIZ;
if (uuid_is_empty(uuid, len))
return 0;
return 0;
va_start(ap, fmt);
- rc = blkid_probe_vsprintf_value(pr, "UUID", fmt, ap);
+
+ if (!strcmp(fmt, "%s")) {
+ struct blkid_prval *v = NULL;
+ const char *str = va_arg(ap, char *);
+
+ if (str && *str)
+ v = blkid_probe_assign_value(pr, "UUID");
+ if (v) {
+ memcpy(v->data, str, len);
+ v->data[len] = '\0';
+ v->len = len;
+ rc = 0;
+ }
+ } else
+ rc = blkid_probe_vsprintf_value(pr, "UUID", fmt, ap);
+
va_end(ap);
/* convert to lower case (..be paranoid) */