diff --git a/sbin/fsck/fsutil.c b/sbin/fsck/fsutil.c index 6d4e96f93d1..3feac0c8a93 100644 --- a/sbin/fsck/fsutil.c +++ b/sbin/fsck/fsutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsutil.c,v 1.24 2019/06/28 13:32:43 deraadt Exp $ */ +/* $OpenBSD: fsutil.c,v 1.25 2025/02/26 06:18:56 otto Exp $ */ /* $NetBSD: fsutil.c,v 1.2 1996/10/03 20:06:31 christos Exp $ */ /* @@ -208,6 +208,10 @@ retry: if (stslash.st_dev == stblock.st_rdev) hot++; raw = rawname(newname); + if (raw == NULL) { + printf("Can't get raw name of %s\n", newname); + return (origname); + } if (stat(raw, &stchar) == -1) { xperror(raw); printf("Can't stat %s\n", raw); diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index f856c89c0cb..72e77f40a78 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.70 2024/02/03 18:51:57 beck Exp $ */ +/* $OpenBSD: setup.c,v 1.71 2025/02/26 06:18:56 otto Exp $ */ /* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */ /* @@ -620,8 +620,10 @@ calcsb(char *dev, int devfd, struct fs *fs, struct disklabel *lp, return (0); } cp--; - if (lp == NULL) + if (lp == NULL) { pfatal("%s: CANNOT READ DISKLABEL\n", dev); + return (0); + } if (isdigit((unsigned char)*cp)) pp = &lp->d_partitions[0]; else @@ -661,7 +663,7 @@ getdisklabel(char *s, int fd) if (ioctl(fd, DIOCGDINFO, (char *)&lab) == -1) { if (s == NULL) return (NULL); - pwarn("ioctl (GCINFO): %s\n", strerror(errno)); + pwarn("ioctl (CGDINFO): %s\n", strerror(errno)); errexit("%s: can't read disk label\n", s); } return (&lab);