diff options
author | Guillem Jover <guillem@debian.org> | 2009-02-27 05:19:55 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2009-02-27 05:31:57 +0200 |
commit | 4b9da2295656cd63e04a4fcc707a575b1f5cd88b (patch) | |
tree | 6041d5ef52f2f559d11a9f07893ee33fcec839e6 /lib | |
parent | a2de4aa132890b97dbe3ec028322562bc2e5b033 (diff) | |
download | dpkg-4b9da2295656cd63e04a4fcc707a575b1f5cd88b.tar.gz |
libdpkg: Generalize f_boolean by not hardcoding to the essential member
Fix the function to use PKGPFIELD to assign to the correct struct
member instead of directly assigning to the essential member. This also
makes this function match its write counterpart w_booleandefno's generic
behaviour.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fields.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/fields.c b/lib/fields.c index ce2b04846..0d32d274c 100644 --- a/lib/fields.c +++ b/lib/fields.c @@ -130,10 +130,14 @@ void f_boolean(struct pkginfo *pigp, struct pkginfoperfile *pifp, enum parsedbflags flags, const char *filename, int lno, FILE *warnto, int *warncount, const char *value, const struct fieldinfo *fip) { + int boolean; + if (!*value) return; - pifp->essential = convert_string(filename, lno, _("yes/no in boolean field"), - -1, pigp, value, booleaninfos, NULL); + + boolean = convert_string(filename, lno, _("yes/no in boolean field"), + -1, pigp, value, booleaninfos, NULL); + PKGPFIELD(pifp, fip->integer, int) = boolean; } void f_section(struct pkginfo *pigp, struct pkginfoperfile *pifp, |