The following commit has been merged in the master branch: commit 4f7898438d28cf3b1d6393a7e9b9135dcc1b1c0d Author: Guillem Jover <guil...@debian.org> Date: Thu Mar 11 19:41:35 2010 +0100
libdpkg: Simplify triggersdir file path generation Now that we have generated the triggersdir via trig_get_triggersdir, we can reuse it to generate the files inside the triggersdir, instead of redoing the same work again. diff --git a/lib/dpkg/trigdeferred.l b/lib/dpkg/trigdeferred.l index 4f410ea..0b53e1a 100644 --- a/lib/dpkg/trigdeferred.l +++ b/lib/dpkg/trigdeferred.l @@ -93,11 +93,10 @@ static FILE *old_deferred; static FILE *trig_new_deferred; static void -constructfn(struct varbuf *vb, const char *admindir, const char *tail) +constructfn(struct varbuf *vb, const char *dir, const char *tail) { varbufreset(vb); - varbufaddstr(vb, admindir); - varbufaddstr(vb, "/" TRIGGERSDIR); + varbufaddstr(vb, dir); varbufaddstr(vb, tail); varbufaddc(vb, 0); } @@ -111,7 +110,7 @@ trigdef_update_start(enum trigdef_updateflags uf, const char *admindir) triggersdir = trig_get_triggersdir(admindir); if (uf & tduf_write) { - constructfn(&fn, admindir, TRIGGERSLOCKFILE); + constructfn(&fn, triggersdir, TRIGGERSLOCKFILE); if (lock_fd == -1) { lock_fd = open(fn.buf, O_RDWR | O_CREAT | O_TRUNC, 0600); if (lock_fd == -1) { @@ -130,7 +129,7 @@ trigdef_update_start(enum trigdef_updateflags uf, const char *admindir) push_cleanup(NULL, 0, NULL, 0, 0); } - constructfn(&fn, admindir, TRIGGERSDEFERREDFILE); + constructfn(&fn, triggersdir, TRIGGERSDEFERREDFILE); r = stat(fn.buf, &stab); if (r) { if (errno != ENOENT) @@ -157,7 +156,7 @@ trigdef_update_start(enum trigdef_updateflags uf, const char *admindir) } if (uf & tduf_write) { - constructfn(&newfn, admindir, TRIGGERSDEFERREDFILE ".new"); + constructfn(&newfn, triggersdir, TRIGGERSDEFERREDFILE ".new"); if (trig_new_deferred) fclose(trig_new_deferred); trig_new_deferred = fopen(newfn.buf, "w"); -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org