66 lines
1.9 KiB
Diff
66 lines
1.9 KiB
Diff
|
|
From 08cf67bb19f8b9cce0c2dd03432951ade476dadd Mon Sep 17 00:00:00 2001
|
||
|
|
From: Andreas Bombe <aeb@debian.org>
|
||
|
|
Date: Thu, 26 Jan 2017 21:31:03 +0100
|
||
|
|
Subject: [PATCH] Turn label in struct DOS_FS into char array from pointer
|
||
|
|
|
||
|
|
Signed-off-by: Andreas Bombe <aeb@debian.org>
|
||
|
|
---
|
||
|
|
src/boot.c | 6 +-----
|
||
|
|
src/fatlabel.c | 2 +-
|
||
|
|
src/fsck.fat.h | 2 +-
|
||
|
|
3 files changed, 3 insertions(+), 7 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/boot.c b/src/boot.c
|
||
|
|
index 58b4286..b4a3300 100644
|
||
|
|
--- a/src/boot.c
|
||
|
|
+++ b/src/boot.c
|
||
|
|
@@ -435,18 +435,14 @@ void read_boot(DOS_FS * fs)
|
||
|
|
fs->eff_fat_bits = (fs->fat_bits == 32) ? 28 : fs->fat_bits;
|
||
|
|
fs->fat_size = fat_length * logical_sector_size;
|
||
|
|
|
||
|
|
- fs->label = calloc(12, sizeof(uint8_t));
|
||
|
|
+ fs->label[0] = 0;
|
||
|
|
if (fs->fat_bits == 12 || fs->fat_bits == 16) {
|
||
|
|
struct boot_sector_16 *b16 = (struct boot_sector_16 *)&b;
|
||
|
|
if (b16->extended_sig == 0x29)
|
||
|
|
memmove(fs->label, b16->label, 11);
|
||
|
|
- else
|
||
|
|
- fs->label = NULL;
|
||
|
|
} else if (fs->fat_bits == 32) {
|
||
|
|
if (b.extended_sig == 0x29)
|
||
|
|
memmove(fs->label, &b.label, 11);
|
||
|
|
- else
|
||
|
|
- fs->label = NULL;
|
||
|
|
}
|
||
|
|
|
||
|
|
total_fat_entries = (uint64_t)fs->fat_size * 8 / fs->fat_bits;
|
||
|
|
diff --git a/src/fatlabel.c b/src/fatlabel.c
|
||
|
|
index 9268ddb..cd3d2ee 100644
|
||
|
|
--- a/src/fatlabel.c
|
||
|
|
+++ b/src/fatlabel.c
|
||
|
|
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
|
||
|
|
if (!rw) {
|
||
|
|
offset = find_volume_de(&fs, &de);
|
||
|
|
if (offset == 0)
|
||
|
|
- fprintf(stdout, "%s\n", fs.label);
|
||
|
|
+ fprintf(stdout, "%11s\n", fs.label);
|
||
|
|
else
|
||
|
|
fprintf(stdout, "%.8s%.3s\n", de.name, de.name + 8);
|
||
|
|
exit(0);
|
||
|
|
diff --git a/src/fsck.fat.h b/src/fsck.fat.h
|
||
|
|
index 5e93178..e91437d 100644
|
||
|
|
--- a/src/fsck.fat.h
|
||
|
|
+++ b/src/fsck.fat.h
|
||
|
|
@@ -164,7 +164,7 @@ typedef struct {
|
||
|
|
off_t backupboot_start; /* 0 if not present */
|
||
|
|
unsigned char *fat;
|
||
|
|
DOS_FILE **cluster_owner;
|
||
|
|
- char *label;
|
||
|
|
+ char label[11];
|
||
|
|
} DOS_FS;
|
||
|
|
|
||
|
|
extern int interactive, rw, list, verbose, test, write_immed;
|
||
|
|
--
|
||
|
|
1.8.3.1
|
||
|
|
|