Source-Changes-HG archive

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

[src/netbsd-3]: src/usr.sbin/mdconfig Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/b175a1170fcc
branches:  netbsd-3
changeset: 577432:b175a1170fcc
user:      tron <tron%NetBSD.org@localhost>
date:      Tue Nov 01 22:36:34 2005 +0000

description:
Pull up following revision(s) (requested by chs in ticket #925):
        usr.sbin/mdconfig/mdconfig.c: revision 1.4
use correct types, allow size to be larger than 1 TB.

diffstat:

 usr.sbin/mdconfig/mdconfig.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 4b210add8f35 -r b175a1170fcc usr.sbin/mdconfig/mdconfig.c
--- a/usr.sbin/mdconfig/mdconfig.c      Tue Nov 01 22:33:25 2005 +0000
+++ b/usr.sbin/mdconfig/mdconfig.c      Tue Nov 01 22:36:34 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mdconfig.c,v 1.3 1997/10/17 10:24:24 lukem Exp $       */
+/*     $NetBSD: mdconfig.c,v 1.3.20.1 2005/11/01 22:36:34 tron Exp $   */
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: mdconfig.c,v 1.3 1997/10/17 10:24:24 lukem Exp $");
+__RCSID("$NetBSD: mdconfig.c,v 1.3.20.1 2005/11/01 22:36:34 tron Exp $");
 #endif
 
 /*
@@ -61,7 +61,8 @@
        char **argv;
 {
        struct md_conf md;
-       int nblks, fd;
+       size_t nblks;
+       int fd;
 
        if (argc <= 2) {
                fprintf(stderr, "usage: mdconfig <device> <%d-byte-blocks>\n",
@@ -69,8 +70,8 @@
                exit(1);
        }
 
-       nblks = atoi(argv[2]);
-       if (nblks <= 0) {
+       nblks = (size_t)strtoul(argv[2], NULL, 0);
+       if (nblks == 0) {
                fprintf(stderr, "invalid number of blocks\n");
                exit(1);
        }
@@ -86,7 +87,7 @@
                                PROT_READ | PROT_WRITE,
                                MAP_ANON | MAP_PRIVATE,
                                -1, 0);
-       if (md.md_addr == (caddr_t)-1) {
+       if (md.md_addr == MAP_FAILED) {
                perror("mmap");
                exit(1);
        }



Home | Main Index | Thread Index | Old Index