From 1ad652a54c103dbdd891e81ceedae09ade0c3f45 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Mon, 18 Nov 1996 16:56:51 +0000 Subject: [PATCH] Fixed uninitialized variables for the '/'-in-pathname case in execvp(). Garbage in `eacces' caused the wrong errno to be set for non-EACCES errors. Garbage in `etxtbsy' caused a semi-random retry strategy for ETXTBSY errors. Found by: NIST-PCTS. gcc -Wall reported the problem, but -Wall is not enabled for libc. --- lib/libc/gen/exec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c index b62ae63e6fd0..2410ce974492 100644 --- a/lib/libc/gen/exec.c +++ b/lib/libc/gen/exec.c @@ -190,6 +190,8 @@ execvp(name, argv) int eacces, etxtbsy; char *bp, *cur, *path, buf[MAXPATHLEN]; + eacces = etxtbsy = 0; + /* If it's an absolute or relative path name, it's easy. */ if (index(name, '/')) { bp = (char *)name; @@ -203,7 +205,6 @@ execvp(name, argv) path = _PATH_DEFPATH; cur = path = strdup(path); - eacces = etxtbsy = 0; while ( (p = strsep(&cur, ":")) ) { /* * It's a SHELL path -- double, leading and trailing colons