From e21f4c8f2e7eb9f974c1bb1ecac03eb947982be6 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Tue, 24 Oct 2006 04:33:40 +0000 Subject: [PATCH] Added PM_DLFNM_LEN define, via VMiklos http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=commitdiff;h=20061023154138-e2957-de4837230b091cbc2136306e1c55a4b79cc72fc8.gz --- lib/libalpm/alpm.c | 5 +++++ lib/libalpm/alpm.h | 2 ++ lib/libalpm/server.c | 10 +++++----- src/pacman/download.c | 2 +- src/pacman/download.h | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 386eee4d..df267e31 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -379,8 +379,13 @@ int alpm_db_update(int force, PM_DB *db) if(_alpm_unpack(path, db->path, NULL)) { RET_ERR(PM_ERR_SYSTEM, 1); } + /* remove the .tar.gz */ + /* aaron: let's not do this... we'll keep the DB around to be read for the + * "new and improved" db routines + unlink(path); + */ } return(0); diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index a0dbe2bd..e3715b42 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -79,6 +79,8 @@ int alpm_logaction(char *fmt, ...); * Options */ +#define PM_DLFNM_LEN 22 + /* Parameters */ enum { PM_OPT_LOGCB = 1, diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c index a5ae9e9f..d86002d2 100644 --- a/lib/libalpm/server.c +++ b/lib/libalpm/server.c @@ -299,22 +299,22 @@ int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath, struct stat st; snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn); if(pm_dlfnm) { - strncpy(pm_dlfnm, fn, 22); + strncpy(pm_dlfnm, fn, PM_DLFNM_LEN); } /* drop filename extension */ ptr = strstr(fn, PM_EXT_DB); - if(pm_dlfnm && ptr && (ptr-fn) < 22) { + if(pm_dlfnm && ptr && (ptr-fn) < PM_DLFNM_LEN) { pm_dlfnm[ptr-fn] = '\0'; } ptr = strstr(fn, PM_EXT_PKG); - if(ptr && (ptr-fn) < 24) { + if(ptr && (ptr-fn) < PM_DLFNM_LEN) { pm_dlfnm[ptr-fn] = '\0'; } if(pm_dlfnm) { - for(j = strlen(pm_dlfnm); j < 22; j++) { + for(j = strlen(pm_dlfnm); j < PM_DLFNM_LEN; j++) { (pm_dlfnm)[j] = ' '; } - pm_dlfnm[22] = '\0'; + pm_dlfnm[PM_DLFNM_LEN] = '\0'; } if(pm_dloffset) { *pm_dloffset = 0; diff --git a/src/pacman/download.c b/src/pacman/download.c index 2be6e242..2b0ad096 100644 --- a/src/pacman/download.c +++ b/src/pacman/download.c @@ -40,7 +40,7 @@ #include "conf.h" /* progress bar */ -char sync_fnm[23]; +char sync_fnm[PM_DLFNM_LEN+1]; int offset; struct timeval t0, t; float rate; diff --git a/src/pacman/download.h b/src/pacman/download.h index a3ff45c2..fb65a4c0 100644 --- a/src/pacman/download.h +++ b/src/pacman/download.h @@ -21,7 +21,7 @@ #ifndef _PM_DOWNLOAD_H #define _PM_DOWNLOAD_H -extern char sync_fnm[23]; +extern char sync_fnm[PM_DLFNM_LEN+1]; extern int offset; extern struct timeval t0, t; extern float rate;