OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | 2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. |
3 * | 3 * |
4 * @APPLE_LICENSE_HEADER_START@ | 4 * @APPLE_LICENSE_HEADER_START@ |
5 * | 5 * |
6 * This file contains Original Code and/or Modifications of Original Code | 6 * This file contains Original Code and/or Modifications of Original Code |
7 * as defined in and that are subject to the Apple Public Source License | 7 * as defined in and that are subject to the Apple Public Source License |
8 * Version 2.0 (the 'License'). You may not use this file except in | 8 * Version 2.0 (the 'License'). You may not use this file except in |
9 * compliance with the License. Please obtain a copy of the License at | 9 * compliance with the License. Please obtain a copy of the License at |
10 * http://www.opensource.apple.com/apsl/ and read it before using this | 10 * http://www.opensource.apple.com/apsl/ and read it before using this |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 q->n_type = 0; | 183 q->n_type = 0; |
184 q->n_value = 0; | 184 q->n_value = 0; |
185 q->n_desc = 0; | 185 q->n_desc = 0; |
186 q->n_sect = 0; | 186 q->n_sect = 0; |
187 q->n_un.n_strx = 0; | 187 q->n_un.n_strx = 0; |
188 } | 188 } |
189 | 189 |
190 struct exec buf; | 190 struct exec buf; |
191 if (read(fd, (char *)&buf, sizeof(buf)) != sizeof(buf) || | 191 if (read(fd, (char *)&buf, sizeof(buf)) != sizeof(buf) || |
192 (N_BADMAG(buf) && *((uint32_t *)&buf) != magic && | 192 (N_BADMAG(buf) && *((uint32_t *)&buf) != magic && |
193 NXSwapBigLongToHost(*((long *)&buf)) != FAT_MAGIC) && | 193 NXSwapBigLongToHost(*((long *)&buf)) != FAT_MAGIC && |
194 /* The following is the big-endian ppc64 check */ | 194 /* The following is the big-endian ppc64 check */ |
195 (*((uint32_t*)&buf)) != FAT_MAGIC) { | 195 (*((uint32_t*)&buf)) != FAT_MAGIC)) { |
196 return -1; | 196 return -1; |
197 } | 197 } |
198 | 198 |
199 /* Deal with fat file if necessary */ | 199 /* Deal with fat file if necessary */ |
200 unsigned arch_offset = 0; | 200 unsigned arch_offset = 0; |
201 if (NXSwapBigLongToHost(*((long *)&buf)) == FAT_MAGIC || | 201 if (NXSwapBigLongToHost(*((long *)&buf)) == FAT_MAGIC || |
202 /* The following is the big-endian ppc64 check */ | 202 /* The following is the big-endian ppc64 check */ |
203 *((unsigned int *)&buf) == FAT_MAGIC) { | 203 *((unsigned int *)&buf) == FAT_MAGIC) { |
204 /* Get host info */ | 204 /* Get host info */ |
205 host_t host = mach_host_self(); | 205 host_t host = mach_host_self(); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 break; | 403 break; |
404 cont: ; | 404 cont: ; |
405 } | 405 } |
406 } | 406 } |
407 if (lseek(fd, savpos, SEEK_SET) == -1) { | 407 if (lseek(fd, savpos, SEEK_SET) == -1) { |
408 return -1; | 408 return -1; |
409 } | 409 } |
410 } | 410 } |
411 return nreq; | 411 return nreq; |
412 } | 412 } |
OLD | NEW |