The following commit has been merged in the master branch:
commit 239b48d8a9a244061bc09d446b9ef0c3732342d6
Author: Guillem Jover <[email protected]>
Date: Sat Feb 27 21:42:40 2010 +0100
libdpkg: Add new trigdef_set_methods to avoid exposing trigdef
Make trigdef static and create a setter function for it.
diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index 75a59a1..8375b7a 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -231,7 +231,7 @@ struct trigdefmeths {
void (*trig_end)(void);
};
-extern const struct trigdefmeths *trigdef;
+void trigdef_set_methods(const struct trigdefmeths *methods);
extern FILE *trig_new_deferred;
/* Return values:
diff --git a/lib/dpkg/trigdeferred.l b/lib/dpkg/trigdeferred.l
index ef3ad3c..11412b4 100644
--- a/lib/dpkg/trigdeferred.l
+++ b/lib/dpkg/trigdeferred.l
@@ -48,6 +48,8 @@
static struct varbuf fn, newfn;
+static const struct trigdefmeths *trigdef;
+
%}
%%
@@ -88,7 +90,6 @@ static int lock_fd = -1;
static FILE *old_deferred;
FILE *trig_new_deferred;
-const struct trigdefmeths *trigdef;
static void
constructfn(struct varbuf *vb, const char *admindir, const char *tail)
@@ -172,6 +173,12 @@ trigdef_update_start(enum trigdef_updateflags uf, const
char *admindir)
}
void
+trigdef_set_methods(const struct trigdefmeths *methods)
+{
+ trigdef = methods;
+}
+
+void
trigdef_process_done(void)
{
int r;
diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index 81f93ea..bbabd30 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -721,7 +721,7 @@ trig_incorporate(enum modstatdb_rw cstatus, const char
*admindir)
int ur;
enum trigdef_updateflags tduf;
- trigdef = &tdm_incorp;
+ trigdef_set_methods(&tdm_incorp);
trig_file_interests_ensure();
tduf = tduf_nolockok;
diff --git a/src/trigcmd.c b/src/trigcmd.c
index 32650fe..b1e82d9 100644
--- a/src/trigcmd.c
+++ b/src/trigcmd.c
@@ -218,7 +218,8 @@ main(int argc, const char *const *argv)
badusage(_("invalid trigger name `%.250s': %.250s"),
activate, badname);
- trigdef = &tdm_add;
+ trigdef_set_methods(&tdm_add);
+
tduf = tduf_nolockok;
if (!f_noact)
tduf |= tduf_write | tduf_writeifempty;
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]