diff options
-rw-r--r-- | sbin/newfs/mkfs.c | 15 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 6 |
2 files changed, 10 insertions, 11 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 0da86cf39cc..2b5c6e5c184 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.34 2003/11/03 05:36:27 tedu Exp $ */ +/* $OpenBSD: mkfs.c,v 1.35 2003/11/03 05:40:09 tedu Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.3 (Berkeley) 2/3/94"; #else -static char rcsid[] = "$OpenBSD: mkfs.c,v 1.34 2003/11/03 05:36:27 tedu Exp $"; +static char rcsid[] = "$OpenBSD: mkfs.c,v 1.35 2003/11/03 05:40:09 tedu Exp $"; #endif #endif /* not lint */ @@ -151,10 +151,10 @@ mkfs(struct partition *pp, char *fsys, int fi, int fo) int width; char tmpbuf[100]; /* XXX this will break in about 2,500 years */ - if ((fsun = (union fs_u *)calloc(1, sizeof (union fs_u))) == 0 || - (cgun = (union cg_u *)calloc(1, sizeof (union cg_u))) == 0 || - (zino = (struct ufs1_dinode *)calloc(1, MAXBSIZE)) == 0 || - (buf = (char *)calloc(1, MAXBSIZE)) == 0) { + if ((fsun = calloc(1, sizeof (union fs_u))) == NULL || + (cgun = calloc(1, sizeof (union cg_u))) == NULL || + (zino = calloc(1, MAXBSIZE)) == NULL || + (buf = calloc(1, MAXBSIZE)) == NULL) { err(1, "calloc"); } @@ -573,9 +573,8 @@ next: sblock.fs_csmask = ~(i - 1); for (sblock.fs_csshift = 0; i > 1; i >>= 1) sblock.fs_csshift++; - if ((fscs = (struct csum *)calloc(1, sblock.fs_cssize)) == 0) { + if ((fscs = calloc(1, sblock.fs_cssize)) == NULL) err(1, "cg summary"); - } sblock.fs_magic = FS_MAGIC; sblock.fs_rotdelay = rotdelay; sblock.fs_minfree = minfree; diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index bc92e24a839..9008edd48c6 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.46 2003/11/03 05:36:27 tedu Exp $ */ +/* $OpenBSD: newfs.c,v 1.47 2003/11/03 05:40:09 tedu Exp $ */ /* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: newfs.c,v 1.46 2003/11/03 05:36:27 tedu Exp $"; +static char rcsid[] = "$OpenBSD: newfs.c,v 1.47 2003/11/03 05:40:09 tedu Exp $"; #endif #endif /* not lint */ @@ -465,7 +465,7 @@ main(int argc, char *argv[]) printf("%s: %s: not a character-special device\n", __progname, special); cp = strchr(argv[0], '\0') - 1; - if (cp == 0 || ((*cp < 'a' || *cp > ('a' + maxpartitions - 1)) + if (cp == NULL || ((*cp < 'a' || *cp > ('a' + maxpartitions - 1)) && !isdigit(*cp))) fatal("%s: can't figure out file system partition", argv[0]); |