Deleted Added
sdiff udiff text old ( 181136 ) new ( 181161 )
full compact
1/*
2 * Copyright (c) 1993 Paul Kranenburg
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/usr.bin/ldd/ldd.c 181136 2008-08-01 21:52:41Z jhb $");
33
34#include <sys/wait.h>
35
36#include <machine/elf.h>
37
38#include <arpa/inet.h>
39
40#include <a.out.h>

--- 37 unchanged lines hidden (view full) ---

78
79static int
80execldd32(char *file, char *fmt1, char *fmt2, int aflag, int vflag)
81{
82 char *argv[8];
83 int i, rval, status;
84
85 unsetenv(LD_ "TRACE_LOADED_OBJECTS");
86
87 rval = 0;
88 i = 0;
89 argv[i++] = strdup(_PATH_LDD32);
90 if (aflag)
91 argv[i++] = strdup("-a");
92 if (vflag)
93 argv[i++] = strdup("-v");
94 if (fmt1) {
95 argv[i++] = strdup("-f");
96 argv[i++] = strdup(fmt1);
97 }
98 if (fmt2) {
99 argv[i++] = strdup("-f");
100 argv[i++] = strdup(fmt2);
101 }
102
103 argv[i++] = strdup(file);
104 argv[i++] = NULL;
105
106 switch (fork()) {
107 case -1:
108 err(1, "fork");
109 break;
110 case 0:
111 execv(_PATH_LDD32, argv);
112 warn("%s", _PATH_LDD32);
113 _exit(1);
114 break;
115 default:
116 if (wait(&status) <= 0) {
117 rval = 1;
118 } else if (WIFSIGNALED(status)) {
119 rval = 1;
120 } else if (WIFEXITED(status) && WEXITSTATUS(status)) {
121 rval = 1;
122 }
123 break;
124 }
125 while (i--)
126 free(argv[i]);
127 setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1);
128 return (rval);
129}
130#endif

--- 96 unchanged lines hidden (view full) ---

227 printf("%s:\n", *argv);
228 fflush(stdout);
229
230 switch (fork()) {
231 case -1:
232 err(1, "fork");
233 break;
234 default:
235 if (wait(&status) <= 0) {
236 warn("wait");
237 rval |= 1;
238 } else if (WIFSIGNALED(status)) {
239 fprintf(stderr, "%s: signal %d\n", *argv,
240 WTERMSIG(status));
241 rval |= 1;
242 } else if (WIFEXITED(status) && WEXITSTATUS(status)) {
243 fprintf(stderr, "%s: exit status %d\n", *argv,
244 WEXITSTATUS(status));
245 rval |= 1;
246 }
247 break;
248 case 0:
249 if (is_shlib == 0) {
250 execl(*argv, *argv, (char *)NULL);

--- 141 unchanged lines hidden ---