Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/modunload s/atoi/strtol/ and check if argument given to...
details: https://anonhg.NetBSD.org/src/rev/7dc041227dde
branches: trunk
changeset: 474827:7dc041227dde
user: hubertf <hubertf%NetBSD.org@localhost>
date: Thu Jul 22 02:04:13 1999 +0000
description:
s/atoi/strtol/ and check if argument given to -i was really a valid
number.
Patch submitted in PR 6456 by lha%stacken.kth.se@localhost
diffstat:
sbin/modunload/modunload.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r d1501123d88e -r 7dc041227dde sbin/modunload/modunload.c
--- a/sbin/modunload/modunload.c Thu Jul 22 01:48:09 1999 +0000
+++ b/sbin/modunload/modunload.c Thu Jul 22 02:04:13 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: modunload.c,v 1.10 1997/09/15 04:03:59 lukem Exp $ */
+/* $NetBSD: modunload.c,v 1.11 1999/07/22 02:04:13 hubertf Exp $ */
/*
* Copyright (c) 1993 Terrence R. Lambert.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: modunload.c,v 1.10 1997/09/15 04:03:59 lukem Exp $");
+__RCSID("$NetBSD: modunload.c,v 1.11 1999/07/22 02:04:13 hubertf Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -82,12 +82,15 @@
int c;
int modnum = -1;
char *modname = NULL;
+ char *endptr;
struct lmc_unload ulbuf;
while ((c = getopt(argc, argv, "i:n:")) != -1) {
switch (c) {
case 'i':
- modnum = atoi(optarg);
+ modnum = strtol(optarg, &endptr, 0);
+ if (*endptr != '\0')
+ errx(1, "not a valid number");
break; /* number */
case 'n':
modname = optarg;
Home |
Main Index |
Thread Index |
Old Index