Blame SOURCES/mailx-12.5-fio.c-Unconditionally-require-wordexp-support.patch

9770e7
From 2bae8ecf04ec2ba6bb9f0af5b80485dd0edb427d Mon Sep 17 00:00:00 2001
9770e7
From: Florian Weimer <fweimer@redhat.com>
9770e7
Date: Mon, 17 Nov 2014 12:48:25 +0100
9770e7
Subject: [PATCH 3/4] fio.c: Unconditionally require wordexp support
9770e7
9770e7
---
9770e7
 fio.c | 67 +++++--------------------------------------------------------------
9770e7
 1 file changed, 5 insertions(+), 62 deletions(-)
9770e7
9770e7
diff --git a/fio.c b/fio.c
9770e7
index 65e8f10..1529236 100644
9770e7
--- a/fio.c
9770e7
+++ b/fio.c
9770e7
@@ -43,12 +43,15 @@ static char sccsid[] = "@(#)fio.c	2.76 (gritter) 9/16/09";
9770e7
 #endif /* not lint */
9770e7
 
9770e7
 #include "rcv.h"
9770e7
+
9770e7
+#ifndef HAVE_WORDEXP
9770e7
+#error wordexp support is required
9770e7
+#endif
9770e7
+
9770e7
 #include <sys/stat.h>
9770e7
 #include <sys/file.h>
9770e7
 #include <sys/wait.h>
9770e7
-#ifdef	HAVE_WORDEXP
9770e7
 #include <wordexp.h>
9770e7
-#endif	/* HAVE_WORDEXP */
9770e7
 #include <unistd.h>
9770e7
 
9770e7
 #if defined (USE_NSS)
9770e7
@@ -481,7 +484,6 @@ next:
9770e7
 static char *
9770e7
 globname(char *name)
9770e7
 {
9770e7
-#ifdef	HAVE_WORDEXP
9770e7
 	wordexp_t we;
9770e7
 	char *cp;
9770e7
 	sigset_t nset;
9770e7
@@ -527,65 +529,6 @@ globname(char *name)
9770e7
 	}
9770e7
 	wordfree(&we);
9770e7
 	return cp;
9770e7
-#else	/* !HAVE_WORDEXP */
9770e7
-	char xname[PATHSIZE];
9770e7
-	char cmdbuf[PATHSIZE];		/* also used for file names */
9770e7
-	int pid, l;
9770e7
-	char *cp, *shell;
9770e7
-	int pivec[2];
9770e7
-	extern int wait_status;
9770e7
-	struct stat sbuf;
9770e7
-
9770e7
-	if (pipe(pivec) < 0) {
9770e7
-		perror("pipe");
9770e7
-		return name;
9770e7
-	}
9770e7
-	snprintf(cmdbuf, sizeof cmdbuf, "echo %s", name);
9770e7
-	if ((shell = value("SHELL")) == NULL)
9770e7
-		shell = SHELL;
9770e7
-	pid = start_command(shell, 0, -1, pivec[1], "-c", cmdbuf, NULL);
9770e7
-	if (pid < 0) {
9770e7
-		close(pivec[0]);
9770e7
-		close(pivec[1]);
9770e7
-		return NULL;
9770e7
-	}
9770e7
-	close(pivec[1]);
9770e7
-again:
9770e7
-	l = read(pivec[0], xname, sizeof xname);
9770e7
-	if (l < 0) {
9770e7
-		if (errno == EINTR)
9770e7
-			goto again;
9770e7
-		perror("read");
9770e7
-		close(pivec[0]);
9770e7
-		return NULL;
9770e7
-	}
9770e7
-	close(pivec[0]);
9770e7
-	if (wait_child(pid) < 0 && WTERMSIG(wait_status) != SIGPIPE) {
9770e7
-		fprintf(stderr, catgets(catd, CATSET, 81,
9770e7
-				"\"%s\": Expansion failed.\n"), name);
9770e7
-		return NULL;
9770e7
-	}
9770e7
-	if (l == 0) {
9770e7
-		fprintf(stderr, catgets(catd, CATSET, 82,
9770e7
-					"\"%s\": No match.\n"), name);
9770e7
-		return NULL;
9770e7
-	}
9770e7
-	if (l == sizeof xname) {
9770e7
-		fprintf(stderr, catgets(catd, CATSET, 83,
9770e7
-				"\"%s\": Expansion buffer overflow.\n"), name);
9770e7
-		return NULL;
9770e7
-	}
9770e7
-	xname[l] = 0;
9770e7
-	for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--)
9770e7
-		;
9770e7
-	cp[1] = '\0';
9770e7
-	if (strchr(xname, ' ') && stat(xname, &sbuf) < 0) {
9770e7
-		fprintf(stderr, catgets(catd, CATSET, 84,
9770e7
-				"\"%s\": Ambiguous.\n"), name);
9770e7
-		return NULL;
9770e7
-	}
9770e7
-	return savestr(xname);
9770e7
-#endif	/* !HAVE_WORDEXP */
9770e7
 }
9770e7
 
9770e7
 /*
9770e7
-- 
9770e7
1.9.3
9770e7