Source-Changes-HG archive

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

[src/trunk]: src/sbin/shutdown When the third arg to fwrite() is a size in by...



details:   https://anonhg.NetBSD.org/src/rev/c94da4c8292c
branches:  trunk
changeset: 328166:c94da4c8292c
user:      apb <apb%NetBSD.org@localhost>
date:      Fri Mar 28 18:27:14 2014 +0000

description:
When the third arg to fwrite() is a size in bytes, then the second arg
should be 1.  sizeof(*mbuf) happens to equal 1, but it's better not
to rely on that.

diffstat:

 sbin/shutdown/shutdown.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 97926462da44 -r c94da4c8292c sbin/shutdown/shutdown.c
--- a/sbin/shutdown/shutdown.c  Fri Mar 28 17:53:47 2014 +0000
+++ b/sbin/shutdown/shutdown.c  Fri Mar 28 18:27:14 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: shutdown.c,v 1.55 2011/08/27 18:54:39 joerg Exp $      */
+/*     $NetBSD: shutdown.c,v 1.56 2014/03/28 18:27:14 apb Exp $        */
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)shutdown.c 8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: shutdown.c,v 1.55 2011/08/27 18:54:39 joerg Exp $");
+__RCSID("$NetBSD: shutdown.c,v 1.56 2014/03/28 18:27:14 apb Exp $");
 #endif
 #endif /* not lint */
 
@@ -331,7 +331,7 @@
                (void)fprintf(pf, "System going down IMMEDIATELY\n\n");
 
        if (mbuflen)
-               (void)fwrite(mbuf, sizeof(*mbuf), mbuflen, pf);
+               (void)fwrite(mbuf, 1, mbuflen, pf);
 
        /*
         * play some games, just in case wall doesn't come back



Home | Main Index | Thread Index | Old Index