Source-Changes-HG archive

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

[src/trunk]: src/bin/cat fix bogus warning for zero-sized files.



details:   https://anonhg.NetBSD.org/src/rev/02c33e5ca78a
branches:  trunk
changeset: 782765:02c33e5ca78a
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Nov 19 19:34:03 2012 +0000

description:
fix bogus warning for zero-sized files.

diffstat:

 bin/cat/cat.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 3e95a4d152eb -r 02c33e5ca78a bin/cat/cat.c
--- a/bin/cat/cat.c     Mon Nov 19 16:07:56 2012 +0000
+++ b/bin/cat/cat.c     Mon Nov 19 19:34:03 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cat.c,v 1.50 2012/11/10 18:42:22 wiz Exp $ */
+/* $NetBSD: cat.c,v 1.51 2012/11/19 19:34:03 christos Exp $    */
 
 /*
  * Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)cat.c      8.2 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: cat.c,v 1.50 2012/11/10 18:42:22 wiz Exp $");
+__RCSID("$NetBSD: cat.c,v 1.51 2012/11/19 19:34:03 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -305,8 +305,9 @@
                if (bsize != 0)
                        buf = malloc(bsize);
                if (buf == NULL) {
+                       if (bsize != 0)
+                               warnx("malloc, using %zu buffer", bsize);
                        bsize = sizeof(fb_buf);
-                       warnx("malloc, using %zu buffer", bsize);
                        buf = fb_buf;
                }
        }



Home | Main Index | Thread Index | Old Index