forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-02-17 557c24d082b6ecb9bfe5407b77ae43fa7650a5dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From 2bae8ecf04ec2ba6bb9f0af5b80485dd0edb427d Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 17 Nov 2014 12:48:25 +0100
Subject: [PATCH 3/4] fio.c: Unconditionally require wordexp support
 
This patch is taken from
ftp://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_12.5-5.debian.tar.xz
 
Upstream-Status: Inappropriate [upstream is dead]
---
 fio.c | 67 +++++--------------------------------------------------------------
 1 file changed, 5 insertions(+), 62 deletions(-)
 
diff --git a/fio.c b/fio.c
index 65e8f10..1529236 100644
--- a/fio.c
+++ b/fio.c
@@ -43,12 +43,15 @@ static char sccsid[] = "@(#)fio.c    2.76 (gritter) 9/16/09";
 #endif /* not lint */
 
 #include "rcv.h"
+
+#ifndef HAVE_WORDEXP
+#error wordexp support is required
+#endif
+
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <sys/wait.h>
-#ifdef    HAVE_WORDEXP
 #include <wordexp.h>
-#endif    /* HAVE_WORDEXP */
 #include <unistd.h>
 
 #if defined (USE_NSS)
@@ -481,7 +484,6 @@ next:
 static char *
 globname(char *name)
 {
-#ifdef    HAVE_WORDEXP
     wordexp_t we;
     char *cp;
     sigset_t nset;
@@ -527,65 +529,6 @@ globname(char *name)
     }
     wordfree(&we);
     return cp;
-#else    /* !HAVE_WORDEXP */
-    char xname[PATHSIZE];
-    char cmdbuf[PATHSIZE];        /* also used for file names */
-    int pid, l;
-    char *cp, *shell;
-    int pivec[2];
-    extern int wait_status;
-    struct stat sbuf;
-
-    if (pipe(pivec) < 0) {
-        perror("pipe");
-        return name;
-    }
-    snprintf(cmdbuf, sizeof cmdbuf, "echo %s", name);
-    if ((shell = value("SHELL")) == NULL)
-        shell = SHELL;
-    pid = start_command(shell, 0, -1, pivec[1], "-c", cmdbuf, NULL);
-    if (pid < 0) {
-        close(pivec[0]);
-        close(pivec[1]);
-        return NULL;
-    }
-    close(pivec[1]);
-again:
-    l = read(pivec[0], xname, sizeof xname);
-    if (l < 0) {
-        if (errno == EINTR)
-            goto again;
-        perror("read");
-        close(pivec[0]);
-        return NULL;
-    }
-    close(pivec[0]);
-    if (wait_child(pid) < 0 && WTERMSIG(wait_status) != SIGPIPE) {
-        fprintf(stderr, catgets(catd, CATSET, 81,
-                "\"%s\": Expansion failed.\n"), name);
-        return NULL;
-    }
-    if (l == 0) {
-        fprintf(stderr, catgets(catd, CATSET, 82,
-                    "\"%s\": No match.\n"), name);
-        return NULL;
-    }
-    if (l == sizeof xname) {
-        fprintf(stderr, catgets(catd, CATSET, 83,
-                "\"%s\": Expansion buffer overflow.\n"), name);
-        return NULL;
-    }
-    xname[l] = 0;
-    for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--)
-        ;
-    cp[1] = '\0';
-    if (strchr(xname, ' ') && stat(xname, &sbuf) < 0) {
-        fprintf(stderr, catgets(catd, CATSET, 84,
-                "\"%s\": Ambiguous.\n"), name);
-        return NULL;
-    }
-    return savestr(xname);
-#endif    /* !HAVE_WORDEXP */
 }
 
 /*
-- 
1.9.3