mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-08 11:02:24 +01:00
Re-allow direct use of nlist.n_name in <nlist.h>
Commit e8d340de
("Remove a.out support from nlist()") introduced a copy
of the definition of nlist from a.out.h. However, as well as having
n_name inside n_un, on the various BSDs n_name could also be accessed
as a direct member of nlist, and this is made use of by FreeBSD's
usr.bin/netstat/main.c. Thus we should also add the same enclosing
anonymous union.
[guillem@hadrons.org:
- Add a minimal unit test. ]
Closes: !4
Signed-off-by: Guillem Jover <guillem@hadrons.org>
This commit is contained in:
parent
9d917aad37
commit
61d378f5e9
@ -36,9 +36,12 @@
|
||||
struct nlist {
|
||||
union {
|
||||
char *n_name;
|
||||
struct n_list *n_next;
|
||||
long n_strx;
|
||||
} n_un;
|
||||
union {
|
||||
char *n_name;
|
||||
struct n_list *n_next;
|
||||
long n_strx;
|
||||
} n_un;
|
||||
};
|
||||
unsigned char n_type;
|
||||
char n_other;
|
||||
short n_desc;
|
||||
|
@ -66,6 +66,8 @@ main(int argc, char **argv)
|
||||
|
||||
assert(*data_pub_ptr == 50);
|
||||
|
||||
assert(nl[0].n_name == nl[0].n_un.n_name);
|
||||
|
||||
rc = nlist(argv[0], nl);
|
||||
assert(rc == 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user