Module Name:    src
Committed By:   enami
Date:           Wed Dec 22 09:39:06 UTC 2010

Modified Files:
        src/bin/dd: args.c

Log Message:
Copy argument before modifying it so that ps shows entire argument.
>From OpenBSD via FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/dd/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/args.c
diff -u src/bin/dd/args.c:1.30 src/bin/dd/args.c:1.31
--- src/bin/dd/args.c:1.30	Tue Dec 14 19:03:21 2010
+++ src/bin/dd/args.c	Wed Dec 22 09:39:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.30 2010/12/14 19:03:21 pooka Exp $	*/
+/*	$NetBSD: args.c,v 1.31 2010/12/22 09:39:06 enami Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)args.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: args.c,v 1.30 2010/12/14 19:03:21 pooka Exp $");
+__RCSID("$NetBSD: args.c,v 1.31 2010/12/22 09:39:06 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -120,6 +120,12 @@
 	in.dbsz = out.dbsz = 512;
 
 	while ((oper = *++argv) != NULL) {
+		if ((oper = strdup(oper)) == NULL) {
+			errx(EXIT_FAILURE,
+			    "unable to allocate space for the argument %s",
+			    *argv);
+			/* NOTREACHED */
+		}
 		if ((arg = strchr(oper, '=')) == NULL) {
 			errx(EXIT_FAILURE, "unknown operand %s", oper);
 			/* NOTREACHED */

Reply via email to