Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/memswitch Fix restore() (-r option). It didn't rea...



details:   https://anonhg.NetBSD.org/src/rev/ce0d2bddb9e8
branches:  trunk
changeset: 760862:ce0d2bddb9e8
user:      minoura <minoura%NetBSD.org@localhost>
date:      Fri Jan 14 13:25:16 2011 +0000

description:
Fix restore() (-r option).  It didn't read the input file.
Apparently I did not test that code.
Pointed out by wiz@, thanks.

diffstat:

 usr.sbin/memswitch/memswitch.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 202ed9de27ad -r ce0d2bddb9e8 usr.sbin/memswitch/memswitch.c
--- a/usr.sbin/memswitch/memswitch.c    Fri Jan 14 13:24:45 2011 +0000
+++ b/usr.sbin/memswitch/memswitch.c    Fri Jan 14 13:25:16 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memswitch.c,v 1.10 2008/04/28 20:24:16 martin Exp $    */
+/*     $NetBSD: memswitch.c,v 1.11 2011/01/14 13:25:16 minoura Exp $   */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -467,7 +467,13 @@
                        err (1, "Opening input file");
        }
 
-       sramfd = open (_PATH_DEVSRAM, O_RDONLY);
+       if (read (fd, modified_values, 256) != 256)
+               err (1, "Reading input file");
+
+       if (fd != 0)
+               close (fd);
+
+       sramfd = open (_PATH_DEVSRAM, O_RDWR);
        if (sramfd < 0)
                err (1, "Opening %s", _PATH_DEVSRAM);
 



Home | Main Index | Thread Index | Old Index