From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12028 Path: news.gmane.org!.POSTED!not-for-mail From: Przemyslaw Pawelczyk Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] Fix execvp failing on not-dir entries in PATH. Date: Mon, 23 Oct 2017 00:07:42 +0200 Message-ID: <20171022220742.21966-1-przemoc@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1508752169 23314 195.159.176.226 (23 Oct 2017 09:49:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 23 Oct 2017 09:49:29 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-12041-gllmg-musl=m.gmane.org@lists.openwall.com Mon Oct 23 11:49:24 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1e6ZMC-0004SG-Iz for gllmg-musl@m.gmane.org; Mon, 23 Oct 2017 11:49:16 +0200 Original-Received: (qmail 30553 invoked by uid 550); 23 Oct 2017 09:49:20 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 11347 invoked from network); 22 Oct 2017 22:08:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=OH6aCjqbxhDv2dnArEa3RDfc0veECOGcqd9PjKSH8A8=; b=ejmKJ5AKXFu9ZsLPjYcJfuWJeSvB789n8Q1tsdLqOH9aa/18YMr47Wl8Uo2GuJvq1N XqChbuL8QPRlweFmo+arGzYvI7GGp6jynAfQyAmpNmYnSPpmng1tn6/U/1yI3xVv4BfA 9h1R+Vp9TODoqo+UZ+C2j3VmGeqc7JI57AZJJHWniUoGDEDyQnd9NkwHXIjCrIy4OdQw 1evWVGCwxGk2bpaSIGwPq69NNu/4nr61v6BLUiVQyuqblchbwDidzg7RSa/T++7VTrlC Oyy1ImJwFwT1kSValXdzbAhM5QDHMopbdVxwJxr3qCvu2yBeVlAmoPMoCyS3eaqQXdGy cjPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=OH6aCjqbxhDv2dnArEa3RDfc0veECOGcqd9PjKSH8A8=; b=ShetYcoaW/dWDjrxgxAbjiU7ZRYHw7OQlvnc2vCimQDocFgB3Gchb1cxZ4UoSfDzJ6 sH0F7xDAmowUAilQlI8rj5Nu1yF0qpml1pZ0JM3oRHAuE1E4T6wBY45hDGp0a16LlW3P j4CmwMoZOgvMEZTpujaILIwQPxvrXDhuIt/32Ptjuz13PNrRHNy31Wk/At8mhEUa7F2o hT8xkjxWBnYhiSMrpgX4+VOEujYDzb9DlZNTiOMwQt8MUtFk8zkaq8pH9nbt07Vo4Wq4 Vrg6S7Zca6eN4jRSCWyCgp5OKQ3LbDZxdUea6SXmvfT1w0E4/gqtjeR4D/+BE9FmcsF/ l8Kg== X-Gm-Message-State: AMCzsaV0fL/zXXu0ZVkRSWgLRCcv1rjb4GsDjqCqtUfmC1c+m0wSajtd 4AOtpcBa+oPc/6gNoi2+QpQkiQ== X-Google-Smtp-Source: ABhQp+ROfkDcN7WsYOWSj7YQRzvGGtQU65b/vur8BCzWG5V1k1ykc3Z/A15tMv3q0ty1+ETB8cacyw== X-Received: by 10.25.228.129 with SMTP id x1mr3093136lfi.232.1508710071350; Sun, 22 Oct 2017 15:07:51 -0700 (PDT) X-Mailer: git-send-email 2.13.5 Xref: news.gmane.org gmane.linux.lib.musl.general:12028 Archived-At: It's better to make execvp continue PATH search on ENOTDIR rather than issuing an error. Bogus entries should not render rest of PATH invalid. --- I'm not subscribed to ML, so please CC me in case of replying. src/process/execvp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/process/execvp.c b/src/process/execvp.c index 3a8bbe83295a..480a85e9383e 100644 --- a/src/process/execvp.c +++ b/src/process/execvp.c @@ -40,7 +40,7 @@ int __execvpe(const char *file, char *const argv[], char *const envp[]) memcpy(b+(z-p)+(z>p), file, k+1); execve(b, argv, envp); if (errno == EACCES) seen_eacces = 1; - else if (errno != ENOENT) return -1; + else if (errno != ENOENT && errno != ENOTDIR) return -1; if (!*z++) break; } if (seen_eacces) errno = EACCES; -- 2.13.5