diff options
author | Guillem Jover <guillem@debian.org> | 2011-03-13 19:51:55 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2011-03-14 07:21:56 +0100 |
commit | 8ecd3414ebcf0a81a4f23b671c134729dc600a3a (patch) | |
tree | 359fad383f6b78cc0013177843dc10501fe0f2d0 /src/statdb.c | |
parent | 18d1daa7bfffdb00af4903ad895151fe60e77ebf (diff) | |
download | dpkg-8ecd3414ebcf0a81a4f23b671c134729dc600a3a.tar.gz |
Use dpkg_db_get_path() instead of ad-hoc building the string with varbuf
Diffstat (limited to 'src/statdb.c')
-rw-r--r-- | src/statdb.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/statdb.c b/src/statdb.c index 0dc217d9e..21eeb5f3a 100644 --- a/src/statdb.c +++ b/src/statdb.c @@ -43,6 +43,7 @@ #include "main.h" static FILE *statoverridefile = NULL; +static char *statoverridename; uid_t statdb_parse_uid(const char *str) @@ -108,22 +109,19 @@ statdb_parse_mode(const char *str) void ensure_statoverrides(void) { - static struct varbuf vb; - struct stat stab1, stab2; FILE *file; char *loaded_list, *loaded_list_end, *thisline, *nextline, *ptr; struct file_stat *fso; struct filenamenode *fnn; - varbuf_reset(&vb); - varbuf_add_str(&vb, admindir); - varbuf_add_str(&vb, "/" STATOVERRIDEFILE); - varbuf_end_str(&vb); + if (statoverridename != NULL) + free(statoverridename); + statoverridename = dpkg_db_get_path(STATOVERRIDEFILE); onerr_abort++; - file = fopen(vb.buf,"r"); + file = fopen(statoverridename, "r"); if (!file) { if (errno != ENOENT) ohshite(_("failed to open statoverride file")); @@ -148,7 +146,7 @@ ensure_statoverrides(void) if (statoverridefile) fclose(statoverridefile); statoverridefile = file; - setcloexec(fileno(statoverridefile), vb.buf); + setcloexec(fileno(statoverridefile), statoverridename); /* If the statoverride list is empty we don't need to bother * reading it. */ @@ -161,7 +159,7 @@ ensure_statoverrides(void) loaded_list_end = loaded_list + stab2.st_size; if (fd_read(fileno(file), loaded_list, stab2.st_size) < 0) - ohshite(_("reading statoverride file '%.250s'"), vb.buf); + ohshite(_("reading statoverride file '%.250s'"), statoverridename); thisline = loaded_list; while (thisline < loaded_list_end) { |