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

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