Index: usr.sbin/fstyp/bfs.c =================================================================== --- usr.sbin/fstyp/bfs.c +++ usr.sbin/fstyp/bfs.c @@ -1,11 +1,12 @@ -/* +/*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2021 Miguel Gocobachi + * Copyright (c) 2021 Miguel Gocobachi * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -23,7 +24,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * From: @(#)style 1.14 (Berkeley) 4/28/95 */ + #include __FBSDID("$FreeBSD$"); @@ -34,7 +38,7 @@ #include "fstyp.h" -#define BFS_OS_NAME_LENGTH 32 +#define BFS_OS_NAME_LENGTH 32 #define BFS_SUPER_BLOCK_MAGIC1 0x42465331 struct bfs_disk_superblock { @@ -47,25 +51,23 @@ { struct bfs_disk_superblock *volume; - volume = read_buf(fp, 512, sizeof(*volume)); + volume = (struct bfs_disk_superblock *) read_buf(fp, 512, sizeof(*volume)); if (volume == NULL) { - free(volume); - return (1); } - if (volume->magic1 != BFS_SUPER_BLOCK_MAGIC1) { + if (volume->magic1 == BFS_SUPER_BLOCK_MAGIC1) { + bzero(label, size); + strlcpy(label, volume->name, MIN(size, BFS_OS_NAME_LENGTH)); + rtrim(label, size); + free(volume); - return (1); + return (0); } - bzero(label, size); - strlcpy(label, volume->name, MIN(size, BFS_OS_NAME_LENGTH)); - rtrim(label, size); - free(volume); - return (0); + return (1); } Index: usr.sbin/fstyp/fstyp.8 =================================================================== --- usr.sbin/fstyp/fstyp.8 +++ usr.sbin/fstyp/fstyp.8 @@ -42,7 +42,7 @@ The .Nm utility is used to determine the filesystem type on a given device. -It can recognize ISO-9660, exFAT, Ext2, FAT, NTFS, and UFS filesystems. +It can recognize BFS (BeOS), ISO-9660, exFAT, Ext2, FAT, NTFS, and UFS filesystems. When the .Fl u flag is specified, @@ -59,6 +59,8 @@ as, respectively: .Bl -item -offset indent -compact .It +bfs +.It cd9660 .It exfat