projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
volume_id: abort early on read failures.
[oweals/busybox.git]
/
util-linux
/
volume_id
/
linux_swap.c
diff --git
a/util-linux/volume_id/linux_swap.c
b/util-linux/volume_id/linux_swap.c
index 56b5d5085a6a619369060800fd254a7a73f0f2a7..c9b62e9bf6bdb3c5a075206e986d0daf41af99e9 100644
(file)
--- a/
util-linux/volume_id/linux_swap.c
+++ b/
util-linux/volume_id/linux_swap.c
@@
-31,8
+31,9
@@
struct swap_header_v1_2 {
#define LARGEST_PAGESIZE 0x4000
#define LARGEST_PAGESIZE 0x4000
-int volume_id_probe_linux_swap(struct volume_id *id
, uint64_t off
)
+int volume_id_probe_linux_swap(struct volume_id *id
/*,uint64_t off*/
)
{
{
+#define off ((uint64_t)0)
struct swap_header_v1_2 *sw;
const uint8_t *buf;
unsigned page;
struct swap_header_v1_2 *sw;
const uint8_t *buf;
unsigned page;
@@
-46,8
+47,8
@@
int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off)
return -1;
if (memcmp(buf, "SWAP-SPACE", 10) == 0) {
return -1;
if (memcmp(buf, "SWAP-SPACE", 10) == 0) {
-
id->type_version[0] = '1';
-
id->type_version[1] = '\0';
+
//
id->type_version[0] = '1';
+
//
id->type_version[1] = '\0';
goto found;
}
goto found;
}
@@
-55,9
+56,9
@@
int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off)
sw = volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2));
if (sw == NULL)
return -1;
sw = volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2));
if (sw == NULL)
return -1;
-
id->type_version[0] = '2';
-
id->type_version[1] = '\0';
-
volume_id_set_label_raw(id, sw->volume_name, 16);
+
//
id->type_version[0] = '2';
+
//
id->type_version[1] = '\0';
+
//
volume_id_set_label_raw(id, sw->volume_name, 16);
volume_id_set_label_string(id, sw->volume_name, 16);
volume_id_set_uuid(id, sw->uuid, UUID_DCE);
goto found;
volume_id_set_label_string(id, sw->volume_name, 16);
volume_id_set_uuid(id, sw->uuid, UUID_DCE);
goto found;
@@
-66,8
+67,8
@@
int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off)
return -1;
found:
return -1;
found:
-
volume_id_set_usage(id, VOLUME_ID_OTHER);
-
id->type = "swap";
+
//
volume_id_set_usage(id, VOLUME_ID_OTHER);
+
//
id->type = "swap";
return 0;
}
return 0;
}