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/a610ae2a1d00
branches:  trunk
changeset: 794906:a610ae2a1d00
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 e3a097a7a7fd -r a610ae2a1d00 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