* %End-Header%
*/
+#define _XOPEN_SOURCE 600 /* for inclusion of strtoull */
+
+#include "config.h"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "uuid/uuid.h"
#ifdef HAVE_STRTOULL
-#define __USE_ISOC9X
#define STRTOULL strtoull /* defined in stdlib.h if you try hard enough */
#else
/* FIXME: need to support real strtoull here */
start = skip_over_blank(start + 1);
end = skip_over_word(start);
- DBG(DEBUG_READ, printf("device should be %*s\n", end - start, start));
+ DBG(DEBUG_READ, printf("device should be %.*s\n",
+ (int)(end - start), start));
if (**cp == '>')
*cp = end;
DBG(DEBUG_READ, printf("found dev %s\n", name));
- if (!(*dev = blkid_get_dev(cache, name, BLKID_DEV_CREATE)))
+ if (!(*dev = blkid_get_dev(cache, name, BLKID_DEV_CREATE))) {
+ free(name);
return -BLKID_ERR_MEM;
+ }
free(name);
return 1;
return ret;
/* Some tags are stored directly in the device struct */
- if (!strcmp(name, "DEVNO"))
+ if (!strcmp(name, "DEVNO"))
dev->bid_devno = STRTOULL(value, 0, 0);
else if (!strcmp(name, "PRI"))
dev->bid_pri = strtol(value, 0, 0);
else if (!strcmp(name, "TIME"))
- /* FIXME: need to parse a long long eventually */
- dev->bid_time = strtol(value, 0, 0);
+ dev->bid_time = STRTOULL(value, 0, 0);
else
ret = blkid_set_tag(dev, name, value, strlen(value));
cache->bic_filename));
goto errout;
}
-
+
DBG(DEBUG_CACHE, printf("reading cache file %s\n",
cache->bic_filename));
}
printf(" dev: name = %s\n", dev->bid_name);
- printf(" dev: DEVNO=\"0x%0llx\"\n", dev->bid_devno);
- printf(" dev: TIME=\"%ld\"\n", dev->bid_time);
+ printf(" dev: DEVNO=\"0x%0llx\"\n", (long long)dev->bid_devno);
+ printf(" dev: TIME=\"%lld\"\n", (long long)dev->bid_time);
printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
printf(" dev: flags = 0x%08X\n", dev->bid_flags);
list_for_each(p, &dev->bid_tags) {
blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
if (tag)
- printf(" tag: %s=\"%s\"\n", tag->bit_name,
+ printf(" tag: %s=\"%s\"\n", tag->bit_name,
tag->bit_val);
else
printf(" tag: NULL\n");