Added DB_TREENAME_LEN define to avoid hardcoded length for database string

This commit is contained in:
Aurelien Foret 2005-03-16 20:23:50 +00:00
parent 57df73517f
commit 22c0037a08
2 changed files with 4 additions and 2 deletions

View file

@ -53,7 +53,7 @@ pmdb_t *db_open(char *root, char *dbpath, char *treename)
return(NULL); return(NULL);
} }
strncpy(db->treename, treename, sizeof(db->treename)-1); strncpy(db->treename, treename, DB_TREENAME_LEN-1);
db->pkgcache = NULL; db->pkgcache = NULL;
db->grpcache = NULL; db->grpcache = NULL;

View file

@ -34,10 +34,12 @@
#define INFRQ_SCRIPLET 0x08 #define INFRQ_SCRIPLET 0x08
#define INFRQ_ALL 0xFF #define INFRQ_ALL 0xFF
#define DB_TREENAME_LEN 128
/* Database */ /* Database */
typedef struct __pmdb_t { typedef struct __pmdb_t {
char *path; char *path;
char treename[128]; char treename[DB_TREENAME_LEN];
DIR *dir; DIR *dir;
PMList *pkgcache; PMList *pkgcache;
PMList *grpcache; PMList *grpcache;