Re: [PATCH 1/5] wall: use xalloc lib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 29, 2010 at 09:27:04AM -0300, Davidlohr Bueso wrote:
> From: Davidlohr Bueso <dave@xxxxxxx>
> 
> Signed-off-by: Davidlohr Bueso <dave@xxxxxxx>
> ---
>  login-utils/wall.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)

 Applied, thanks. 

> diff --git a/login-utils/wall.c b/login-utils/wall.c
> index 38c5442..0f43495 100644
> --- a/login-utils/wall.c
> +++ b/login-utils/wall.c
> @@ -58,6 +58,7 @@
>  #include <utmp.h>
>  
>  #include "nls.h"
> +#include "xalloc.h"
>  #include "strutils.h"
>  #include "ttymsg.h"
>  #include "pathnames.h"
> @@ -242,10 +243,8 @@ makemsg(fname)
>  		exit(1);
>  	}
>  	mbufsize = sbuf.st_size;
> -	if (!(mbuf = malloc((u_int)mbufsize))) {
> -		(void)fprintf(stderr, _("%s: Out of memory!\n"), progname);
> -		exit(1);
> -	}
> +	mbuf = xmalloc(mbufsize);
> +
>  	if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize) {
>  		(void)fprintf(stderr, _("%s: can't read temporary file.\n"), progname);
>  		exit(1);

 It would be nice to use err() here ;-)

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux