/[gentoo-projects]/pax-utils/scanmacho.c
Gentoo

Diff of /pax-utils/scanmacho.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.16 Revision 1.17
1/* 1/*
2 * Copyright 2008 Gentoo Foundation 2 * Copyright 2008 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2 3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v 1.16 2009/12/20 20:37:09 grobian Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v 1.17 2010/01/15 11:06:33 vapier Exp $
5 * 5 *
6 * based on scanelf by: 6 * based on scanelf by:
7 * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org> 7 * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org>
8 * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org> 8 * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org>
9 * for Darwin specific fun: 9 * for Darwin specific fun:
10 * 2008 Fabian Groffen - <grobian@gentoo.org> 10 * 2008 Fabian Groffen - <grobian@gentoo.org>
11 */ 11 */
12 12
13static const char *rcsid = "$Id: scanmacho.c,v 1.16 2009/12/20 20:37:09 grobian Exp $"; 13static const char *rcsid = "$Id: scanmacho.c,v 1.17 2010/01/15 11:06:33 vapier Exp $";
14const char * const argv0 = "scanmacho"; 14const char * const argv0 = "scanmacho";
15 15
16#include "paxinc.h" 16#include "paxinc.h"
17 17
18#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') 18#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+')
70 lcmd = firstloadcmd(fobj); 70 lcmd = firstloadcmd(fobj);
71 lc_load_dylib = MGET(fobj->swapped, LC_LOAD_DYLIB); 71 lc_load_dylib = MGET(fobj->swapped, LC_LOAD_DYLIB);
72 72
73 do { 73 do {
74 if (lcmd->lcmd->cmd == lc_load_dylib) { 74 if (lcmd->lcmd->cmd == lc_load_dylib) {
75 struct dylib_command *dlcmd = (struct dylib_command*)lcmd->data; 75 struct dylib_command *dlcmd = lcmd->data;
76 char *needed; 76 char *needed;
77 needed = (char *)(lcmd->data + MGET(fobj->swapped, dlcmd->dylib.name.offset)); 77 needed = lcmd->data + MGET(fobj->swapped, dlcmd->dylib.name.offset);
78 if (op == 0) { 78 if (op == 0) {
79 if (!be_wewy_wewy_quiet) { 79 if (!be_wewy_wewy_quiet) {
80 if (*found_needed) 80 if (*found_needed)
81 xchrcat(ret, ',', ret_len); 81 xchrcat(ret, ',', ret_len);
82 xstrcat(ret, needed, ret_len); 82 xstrcat(ret, needed, ret_len);
111 lcmd = firstloadcmd(fobj); 111 lcmd = firstloadcmd(fobj);
112 lc_load_dylinker = MGET(fobj->swapped, LC_LOAD_DYLINKER); 112 lc_load_dylinker = MGET(fobj->swapped, LC_LOAD_DYLINKER);
113 113
114 do { 114 do {
115 if (lcmd->lcmd->cmd == lc_load_dylinker) { 115 if (lcmd->lcmd->cmd == lc_load_dylinker) {
116 struct dylinker_command *dlcmd =
117 (struct dylinker_command*)lcmd->data; 116 struct dylinker_command *dlcmd = lcmd->data;
118 char *dylinker; 117 char *dylinker;
119 dylinker = (char *)(lcmd->data + MGET(fobj->swapped, dlcmd->name.offset)); 118 dylinker = lcmd->data + MGET(fobj->swapped, dlcmd->name.offset);
120 *found_interp = 1; 119 *found_interp = 1;
121 free(lcmd); 120 free(lcmd);
122 return (be_wewy_wewy_quiet ? NULL : dylinker); 121 return (be_wewy_wewy_quiet ? NULL : dylinker);
123 } 122 }
124 } while (nextloadcmd(lcmd)); 123 } while (nextloadcmd(lcmd));
137 lcmd = firstloadcmd(fobj); 136 lcmd = firstloadcmd(fobj);
138 lc_id_dylib = MGET(fobj->swapped, LC_ID_DYLIB); 137 lc_id_dylib = MGET(fobj->swapped, LC_ID_DYLIB);
139 138
140 do { 139 do {
141 if (lcmd->lcmd->cmd == lc_id_dylib) { 140 if (lcmd->lcmd->cmd == lc_id_dylib) {
142 struct dylib_command *dlcmd = (struct dylib_command*)lcmd->data; 141 struct dylib_command *dlcmd = lcmd->data;
143 char *soname; 142 char *soname;
144 soname = (char *)(lcmd->data + MGET(fobj->swapped, dlcmd->dylib.name.offset)); 143 soname = lcmd->data + MGET(fobj->swapped, dlcmd->dylib.name.offset);
145 *found_soname = 1; 144 *found_soname = 1;
146 free(lcmd); 145 free(lcmd);
147 return (be_wewy_wewy_quiet ? NULL : soname); 146 return (be_wewy_wewy_quiet ? NULL : soname);
148 } 147 }
149 } while (nextloadcmd(lcmd)); 148 } while (nextloadcmd(lcmd));

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20