version 1.3, 2002/03/15 17:49:51 |
version 1.4, 2002/03/19 21:17:52 |
|
|
sym_check_aout(const char *name, struct pstate *ps) |
sym_check_aout(const char *name, struct pstate *ps) |
{ |
{ |
struct exec ahdr; |
struct exec ahdr; |
|
int error = 0; |
int fd; |
int fd; |
|
|
if ((fd = open(name, O_RDONLY)) < 0) |
if ((fd = open(name, O_RDONLY)) < 0) |
return (-1); |
return (1); |
|
|
if (pread(fd, &ahdr, sizeof(ahdr), 0) != sizeof(ahdr)) { |
if (pread(fd, &ahdr, sizeof(ahdr), 0) != sizeof(ahdr)) { |
#ifndef IGNORE_PREAD_ERRORS |
#ifndef IGNORE_PREAD_ERRORS |
return (-1); |
error = 1; |
#endif |
#endif |
} |
} |
|
|
if (N_BADMAG(ahdr)) { |
if (N_BADMAG(ahdr)) { |
return (-1); |
error = 1; |
} |
} |
|
|
close(fd); |
close(fd); |
|
|
ps->ps_sops = &aout_sops; |
if (!error) |
|
ps->ps_sops = &aout_sops; |
|
|
return (0); |
return (error); |
} |
} |
|
|
struct sym_table * |
struct sym_table * |