Re: makefs: malloc -> emalloc

2017-11-01 Thread Jeremie Courreges-Anglas
On Wed, Nov 01 2017, "Michael W. Bombardieri"  wrote:
> Hello,
>
> makefs has an xmalloc.c with emalloc() function, but one thing
> was still using malloc() directly. This patch makes malloc()
> always happen through emalloc().

Fails to build, implicit emalloc decl.

> - Michael
>
>
> Index: msdos/mkfs_msdos.c
> ===
> RCS file: /cvs/src/usr.sbin/makefs/msdos/mkfs_msdos.c,v
> retrieving revision 1.4
> diff -u -p -u -r1.4 mkfs_msdos.c
> --- msdos/mkfs_msdos.c28 Mar 2017 00:08:39 -  1.4
> +++ msdos/mkfs_msdos.c1 Nov 2017 02:58:21 -
> @@ -592,8 +592,7 @@ mkfs_msdos(const char *fname, const char
>  gettimeofday(, NULL);
>  now = tv.tv_sec;
>  tm = localtime();
> -if (!(img = malloc(bpb.bps)))
> -err(1, NULL);
> +img = emalloc(bpb.bps);
>  dir = bpb.res + (bpb.spf ? bpb.spf : bpb.bspf) * bpb.nft;
>  signal(SIGINFO, infohandler);
>  for (lsn = 0; lsn < dir + (o.fat_type == 32 ? bpb.spc : rds); lsn++) {
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



makefs: malloc -> emalloc

2017-10-31 Thread Michael W. Bombardieri
Hello,

makefs has an xmalloc.c with emalloc() function, but one thing
was still using malloc() directly. This patch makes malloc()
always happen through emalloc().

- Michael


Index: msdos/mkfs_msdos.c
===
RCS file: /cvs/src/usr.sbin/makefs/msdos/mkfs_msdos.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 mkfs_msdos.c
--- msdos/mkfs_msdos.c  28 Mar 2017 00:08:39 -  1.4
+++ msdos/mkfs_msdos.c  1 Nov 2017 02:58:21 -
@@ -592,8 +592,7 @@ mkfs_msdos(const char *fname, const char
 gettimeofday(, NULL);
 now = tv.tv_sec;
 tm = localtime();
-if (!(img = malloc(bpb.bps)))
-err(1, NULL);
+img = emalloc(bpb.bps);
 dir = bpb.res + (bpb.spf ? bpb.spf : bpb.bspf) * bpb.nft;
 signal(SIGINFO, infohandler);
 for (lsn = 0; lsn < dir + (o.fat_type == 32 ? bpb.spc : rds); lsn++) {