Module Name:    src
Committed By:   uwe
Date:           Sat Dec 23 18:25:03 UTC 2017

Modified Files:
        src/lib/libedit: history.c

Log Message:
The order in which the arguments to a function are evaluated is
undefined, so don't use va_arg() twice.

PR lib/52849


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/lib/libedit/history.c

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

Modified files:

Index: src/lib/libedit/history.c
diff -u src/lib/libedit/history.c:1.58 src/lib/libedit/history.c:1.59
--- src/lib/libedit/history.c:1.58	Fri Sep  1 10:19:10 2017
+++ src/lib/libedit/history.c	Sat Dec 23 18:25:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.58 2017/09/01 10:19:10 christos Exp $	*/
+/*	$NetBSD: history.c,v 1.59 2017/12/23 18:25:03 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.58 2017/09/01 10:19:10 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.59 2017/12/23 18:25:03 uwe Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -1082,11 +1082,13 @@ FUNW(history)(TYPE(History) *h, TYPE(His
 		break;
 
 	case H_NSAVE_FP:
-		retval = history_save_fp(h, va_arg(va, size_t),
-		    va_arg(va, FILE *));
+	{
+		size_t sz = va_arg(va, size_t);
+		retval = history_save_fp(h, sz, va_arg(va, FILE *));
 		if (retval == -1)
 		    he_seterrev(ev, _HE_HIST_WRITE);
 		break;
+	}
 
 	case H_PREV_EVENT:
 		retval = history_prev_event(h, ev, va_arg(va, int));

Reply via email to