dosfstools/dosfstools-dosfslabel-from-rootdir.patch
Petr Gajdos b476038bc2 - update to 3.0.15: bugfixes for device detection, root directory
allocation, and messages about unicode filenames. 
  * dropped dosfstools-filename-buffer-overflow.patch (upstreamed)
  * dropped dosfstools-mdraid-partition.patch (upstreamed)
  * refreshed dosfstools-suse-dirs.patch
  * refreshed ppc-reserved-sectors-fix.patch
    (will be dropped if not upstreamed)
  * dosfstools-label.patch splitted to:
    - dosfstools-create-rootdir-label.patch
    - dosfstools-dosfslabel-forbid-lowercase.patch
    - dosfstools-dosfslabel-from-rootdir.patch
    - dosfstools-fsck-file-name.patch
    - dosfstools-mkdosfs-no-label.patch
    - dosfstools-mkdosfs-uppercase-label.patch
    (will be upstreamed or dropped)

OBS-URL: https://build.opensuse.org/package/show/Base:System/dosfstools?expand=0&rev=31
2013-02-27 14:39:12 +00:00

55 lines
1.7 KiB
Diff

Read label also from rootdir entry.
https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
Index: dosfstools-3.0.15/src/boot.c
===================================================================
--- dosfstools-3.0.15.orig/src/boot.c
+++ dosfstools-3.0.15/src/boot.c
@@ -498,7 +498,7 @@ static void write_boot_label(DOS_FS * fs
fs_write(fs->backupboot_start, sizeof(b), &b);
}
-static loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de)
+loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de)
{
unsigned long cluster;
loff_t offset;
Index: dosfstools-3.0.15/src/boot.h
===================================================================
--- dosfstools-3.0.15.orig/src/boot.h
+++ dosfstools-3.0.15/src/boot.h
@@ -25,6 +25,7 @@
void read_boot(DOS_FS * fs);
void write_label(DOS_FS * fs, char *label);
+loff_t find_volume_de(DOS_FS *fs, DIR_ENT *de);
/* Reads the boot sector from the currently open device and initializes *FS */
Index: dosfstools-3.0.15/src/dosfslabel.c
===================================================================
--- dosfstools-3.0.15.orig/src/dosfslabel.c
+++ dosfstools-3.0.15/src/dosfslabel.c
@@ -92,6 +92,9 @@ int main(int argc, char *argv[])
char *device = NULL;
char *label = NULL;
+ loff_t offset;
+ DIR_ENT de;
+
check_atari();
if (argc < 2 || argc > 3)
@@ -127,7 +130,11 @@ int main(int argc, char *argv[])
if (fs.fat_bits == 32)
read_fat(&fs);
if (!rw) {
- fprintf(stdout, "%s\n", fs.label);
+ offset = find_volume_de(&fs, &de);
+ if (offset == 0)
+ fprintf(stdout, "%s\n", fs.label);
+ else
+ fprintf(stdout, "%.8s%.3s\n", de.name, de.ext);
exit(0);
}