* Updated conflict checking one last time. You can finally have a file move
from one package to another seemlessly (knock on wood). This is implemented through the use of two skip lists in the trans struct- skip_add and skip_remove, which replace the former trans->skiplist. * Removed an unnecessary function parameter, added a necessary one. * If a package has no backup files, print '(none)' under the heading so it is more obvious. * Updated my TODO list.
This commit is contained in:
parent
3f802fb38e
commit
03f034ef0e
8 changed files with 122 additions and 113 deletions
6
TODO.dan
6
TODO.dan
|
@ -117,3 +117,9 @@ Fix inconsistency of args- _alpm_db_read, _alpm_db_write
|
||||||
Resurrect test scripts, and add ones as needed. Testing by scripts > testing by
|
Resurrect test scripts, and add ones as needed. Testing by scripts > testing by
|
||||||
hand.
|
hand.
|
||||||
|
|
||||||
|
Build a replacement for this, or at least standardize its use. We shouldn't
|
||||||
|
always need to pass handle->root around, it is constant. Something like char*
|
||||||
|
buildpath(file).
|
||||||
|
/* build the new entryname relative to handle->root */
|
||||||
|
snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname);
|
||||||
|
|
||||||
|
|
|
@ -316,25 +316,19 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
||||||
/* Check for file conflicts
|
/* Check for file conflicts
|
||||||
*/
|
*/
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_FORCE)) {
|
if(!(trans->flags & PM_TRANS_FLAG_FORCE)) {
|
||||||
alpm_list_t *skiplist = NULL;
|
|
||||||
|
|
||||||
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
|
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, _("looking for file conflicts"));
|
_alpm_log(PM_LOG_DEBUG, _("looking for file conflicts"));
|
||||||
lp = _alpm_db_find_conflicts(db, trans, handle->root, &skiplist);
|
lp = _alpm_db_find_conflicts(db, trans, handle->root);
|
||||||
if(lp != NULL) {
|
if(lp != NULL) {
|
||||||
if(data) {
|
if(data) {
|
||||||
*data = lp;
|
*data = lp;
|
||||||
} else {
|
} else {
|
||||||
FREELIST(lp);
|
FREELIST(lp);
|
||||||
}
|
}
|
||||||
FREELIST(skiplist);
|
|
||||||
RET_ERR(PM_ERR_FILE_CONFLICTS, -1);
|
RET_ERR(PM_ERR_FILE_CONFLICTS, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the file skiplist into the transaction */
|
|
||||||
trans->skiplist = skiplist;
|
|
||||||
|
|
||||||
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
|
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +417,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
|
||||||
if(oldpkg) {
|
if(oldpkg) {
|
||||||
/* this is kinda odd. If the old package exists, at this point we make a
|
/* this is kinda odd. If the old package exists, at this point we make a
|
||||||
* NEW transaction, unrelated to handle->trans, and instantiate a "remove"
|
* NEW transaction, unrelated to handle->trans, and instantiate a "remove"
|
||||||
* with the type PM_TRANS_TYPE_UPGRADE */
|
* with the type PM_TRANS_TYPE_UPGRADE. TODO: kill this weird behavior. */
|
||||||
pmtrans_t *tr = _alpm_trans_new();
|
pmtrans_t *tr = _alpm_trans_new();
|
||||||
_alpm_log(PM_LOG_DEBUG, _("removing old package first (%s-%s)"), oldpkg->name, oldpkg->version);
|
_alpm_log(PM_LOG_DEBUG, _("removing old package first (%s-%s)"), oldpkg->name, oldpkg->version);
|
||||||
|
|
||||||
|
@ -441,8 +435,8 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
|
||||||
RET_ERR(PM_ERR_TRANS_ABORT, -1);
|
RET_ERR(PM_ERR_TRANS_ABORT, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the skiplist over */
|
/* copy the remove skiplist over */
|
||||||
tr->skiplist = alpm_list_strdup(trans->skiplist);
|
tr->skip_remove = alpm_list_strdup(trans->skip_remove);
|
||||||
alpm_list_t *b;
|
alpm_list_t *b;
|
||||||
|
|
||||||
/* Add files in the NEW package's backup array to the noupgrade array
|
/* Add files in the NEW package's backup array to the noupgrade array
|
||||||
|
@ -538,11 +532,19 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
|
||||||
|
|
||||||
/* if a file is in NoExtract then we never extract it */
|
/* if a file is in NoExtract then we never extract it */
|
||||||
if(alpm_list_find_str(handle->noextract, entryname)) {
|
if(alpm_list_find_str(handle->noextract, entryname)) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("%s is in NoExtract, skipping extraction"), entryname);
|
||||||
alpm_logaction(_("notice: %s is in NoExtract -- skipping extraction"), entryname);
|
alpm_logaction(_("notice: %s is in NoExtract -- skipping extraction"), entryname);
|
||||||
archive_read_data_skip(archive);
|
archive_read_data_skip(archive);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if a file is in the add skiplist we never extract it */
|
||||||
|
if(alpm_list_find_str(trans->skip_add, filename)) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("%s is in trans->skip_add, skipping extraction"), entryname);
|
||||||
|
archive_read_data_skip(archive);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* check is file already exists */
|
/* check is file already exists */
|
||||||
if(stat(filename, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
|
if(stat(filename, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
|
||||||
/* it does, is it a backup=() file?
|
/* it does, is it a backup=() file?
|
||||||
|
|
|
@ -313,8 +313,7 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
|
||||||
return(conflicts);
|
return(conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root,
|
alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
||||||
alpm_list_t **skip_list)
|
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *k;
|
alpm_list_t *i, *j, *k;
|
||||||
alpm_list_t *conflicts = NULL;
|
alpm_list_t *conflicts = NULL;
|
||||||
|
@ -366,50 +365,54 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root,
|
||||||
if(dbpkg) {
|
if(dbpkg) {
|
||||||
/* older ver of package currently installed */
|
/* older ver of package currently installed */
|
||||||
tmpfiles = chk_filedifference(p1->files, alpm_pkg_get_files(dbpkg));
|
tmpfiles = chk_filedifference(p1->files, alpm_pkg_get_files(dbpkg));
|
||||||
for(j = tmpfiles; j; j = j->next) {
|
} else {
|
||||||
filestr = j->data;
|
/* no version of package currently installed */
|
||||||
_alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s", filestr);
|
tmpfiles = alpm_list_strdup(p1->files);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", root, filestr);
|
/* loop over each file to be installed */
|
||||||
|
for(j = tmpfiles; j; j = j->next) {
|
||||||
|
filestr = j->data;
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s", filestr);
|
||||||
|
|
||||||
/* stat the file - if it exists and is not a dir, do some checks */
|
snprintf(path, PATH_MAX, "%s%s", root, filestr);
|
||||||
if(lstat(path, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
|
|
||||||
/* Look at all the targets to see if file has changed hands */
|
/* stat the file - if it exists and is not a dir, do some checks */
|
||||||
for(k = targets; k; k = k->next) {
|
if(lstat(path, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
|
||||||
p2 = (pmpkg_t *)k->data;
|
/* Look at all the targets to see if file has changed hands */
|
||||||
/* Ensure we aren't looking at current package */
|
for(k = targets; k; k = k->next) {
|
||||||
if(strcmp(p2->name, p1->name)) {
|
p2 = (pmpkg_t *)k->data;
|
||||||
pmpkg_t *localp2 = _alpm_db_get_pkgfromcache(db, p2->name);
|
/* Ensure we aren't looking at current package */
|
||||||
/* Check if it used to exist in a package, but doesn't anymore */
|
if(p2 == p1) {
|
||||||
if(localp2 && !alpm_list_find_str(alpm_pkg_get_files(p2), filestr)
|
continue;
|
||||||
&& alpm_list_find_str(alpm_pkg_get_files(localp2), filestr)) {
|
}
|
||||||
*skip_list = alpm_list_add(*skip_list, strdup(filestr));
|
pmpkg_t *localp2 = _alpm_db_get_pkgfromcache(db, p2->name);
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding to skiplist: %s", filestr);
|
/* Check if it used to exist in a package, but doesn't anymore */
|
||||||
} else {
|
if(localp2 && !alpm_list_find_str(alpm_pkg_get_files(p2), filestr)
|
||||||
conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE,
|
&& alpm_list_find_str(alpm_pkg_get_files(localp2), filestr)) {
|
||||||
filestr, p1->name, NULL);
|
/* check if the file is now in the backup array */
|
||||||
break;
|
if(alpm_list_find_str(alpm_pkg_get_backup(p1), filestr)) {
|
||||||
}
|
/* keep file intact if it is in backup array */
|
||||||
|
trans->skip_add = alpm_list_add(trans->skip_add, strdup(path));
|
||||||
|
trans->skip_remove = alpm_list_add(trans->skip_remove, strdup(path));
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "file in backup array, adding to add and remove skiplist: %s", filestr);
|
||||||
|
} else {
|
||||||
|
/* skip removal of file, but not add. this will prevent a second
|
||||||
|
* package from removing the file when it was already installed
|
||||||
|
* by its new owner */
|
||||||
|
trans->skip_remove = alpm_list_add(trans->skip_remove, strdup(path));
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s", filestr);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE,
|
||||||
|
filestr, p1->name, NULL);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alpm_list_free_inner(tmpfiles, &free);
|
|
||||||
alpm_list_free(tmpfiles);
|
|
||||||
} else {
|
|
||||||
/* no version of package currently installed */
|
|
||||||
for(j = p1->files; j; j = j->next) {
|
|
||||||
filestr = j->data;
|
|
||||||
|
|
||||||
snprintf(path, PATH_MAX, "%s%s", root, filestr);
|
|
||||||
|
|
||||||
/* stat the file - if it exists and is not a dir, report a conflict */
|
|
||||||
if(lstat(path, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
|
|
||||||
conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE,
|
|
||||||
filestr, p1->name, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
alpm_list_free_inner(tmpfiles, &free);
|
||||||
|
alpm_list_free(tmpfiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(conflicts);
|
return(conflicts);
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct __pmconflict_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages);
|
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages);
|
||||||
alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, alpm_list_t **skip_list);
|
alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root);
|
||||||
|
|
||||||
#endif /* _ALPM_CONFLICT_H */
|
#endif /* _ALPM_CONFLICT_H */
|
||||||
|
|
||||||
|
|
|
@ -155,19 +155,15 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int can_remove_file(const char *path)
|
static int can_remove_file(pmtrans_t *trans, const char *path)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
|
||||||
char file[PATH_MAX+1];
|
char file[PATH_MAX+1];
|
||||||
|
|
||||||
snprintf(file, PATH_MAX, "%s%s", handle->root, path);
|
snprintf(file, PATH_MAX, "%s%s", handle->root, path);
|
||||||
|
|
||||||
for(i = handle->trans->skiplist; i; i = i->next) {
|
if(alpm_list_find_str(trans->skip_remove, file)) {
|
||||||
if(strcmp(file, i->data) == 0) {
|
/* return success because we will never actually remove this file */
|
||||||
/* skipping this file, return success because "removing" this
|
return(1);
|
||||||
* file does nothing */
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* If we fail write permissions due to a read-only filesystem, abort.
|
/* If we fail write permissions due to a read-only filesystem, abort.
|
||||||
* Assume all other possible failures are covered somewhere else */
|
* Assume all other possible failures are covered somewhere else */
|
||||||
|
@ -175,7 +171,8 @@ static int can_remove_file(const char *path)
|
||||||
if(access(file, F_OK) == 0) {
|
if(access(file, F_OK) == 0) {
|
||||||
/* only return failure if the file ACTUALLY exists and we don't have
|
/* only return failure if the file ACTUALLY exists and we don't have
|
||||||
* permissions */
|
* permissions */
|
||||||
_alpm_log(PM_LOG_ERROR, _("cannot remove file '%s': %s"), file, strerror(errno));
|
_alpm_log(PM_LOG_ERROR, _("cannot remove file '%s': %s"),
|
||||||
|
file, strerror(errno));
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,19 +227,11 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
|
||||||
_alpm_log(PM_LOG_DEBUG, _("removing directory %s"), file);
|
_alpm_log(PM_LOG_DEBUG, _("removing directory %s"), file);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* check the "skip list" before removing the file.
|
/* check the remove skip list before removing the file.
|
||||||
* see the big comment block in db_find_conflicts() for an
|
* see the big comment block in db_find_conflicts() for an
|
||||||
* explanation. */
|
* explanation. */
|
||||||
int skipit = 0;
|
if(alpm_list_find_str(trans->skip_remove, file)) {
|
||||||
alpm_list_t *j;
|
_alpm_log(PM_LOG_DEBUG, _("%s is in trans->skip_remove, skipping removal"), file);
|
||||||
for(j = trans->skiplist; j; j = j->next) {
|
|
||||||
if(!strcmp(lp->data, (char*)j->data)) {
|
|
||||||
skipit = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(skipit) {
|
|
||||||
_alpm_log(PM_LOG_WARNING, _("%s has changed ownership, skipping removal"),
|
|
||||||
file);
|
|
||||||
} else if(needbackup) {
|
} else if(needbackup) {
|
||||||
/* if the file is flagged, back it up to .pacsave */
|
/* if the file is flagged, back it up to .pacsave */
|
||||||
if(!(trans->type == PM_TRANS_TYPE_UPGRADE)) {
|
if(!(trans->type == PM_TRANS_TYPE_UPGRADE)) {
|
||||||
|
@ -301,7 +290,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
|
||||||
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
||||||
for(lp = info->files; lp; lp = lp->next) {
|
for(lp = info->files; lp; lp = lp->next) {
|
||||||
if(!can_remove_file(lp->data)) {
|
if(!can_remove_file(trans, lp->data)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, _("not removing package '%s', can't remove all files"), info->name);
|
_alpm_log(PM_LOG_DEBUG, _("not removing package '%s', can't remove all files"), info->name);
|
||||||
RET_ERR(PM_ERR_PKG_CANT_REMOVE, -1);
|
RET_ERR(PM_ERR_PKG_CANT_REMOVE, -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,8 @@ pmtrans_t *_alpm_trans_new()
|
||||||
|
|
||||||
trans->targets = NULL;
|
trans->targets = NULL;
|
||||||
trans->packages = NULL;
|
trans->packages = NULL;
|
||||||
trans->skiplist = NULL;
|
trans->skip_add = NULL;
|
||||||
|
trans->skip_remove = NULL;
|
||||||
trans->type = 0;
|
trans->type = 0;
|
||||||
trans->flags = 0;
|
trans->flags = 0;
|
||||||
trans->cb_event = NULL;
|
trans->cb_event = NULL;
|
||||||
|
@ -87,7 +88,8 @@ void _alpm_trans_free(void *data)
|
||||||
FREELISTPKGS(trans->packages);
|
FREELISTPKGS(trans->packages);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREELIST(trans->skiplist);
|
FREELIST(trans->skip_add);
|
||||||
|
FREELIST(trans->skip_remove);
|
||||||
|
|
||||||
FREE(trans);
|
FREE(trans);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,10 @@ struct __pmtrans_t {
|
||||||
pmtranstype_t type;
|
pmtranstype_t type;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
pmtransstate_t state;
|
pmtransstate_t state;
|
||||||
alpm_list_t *targets; /* alpm_list_t of (char *) */
|
alpm_list_t *targets; /* list of (char *) */
|
||||||
alpm_list_t *packages; /* alpm_list_t of (pmpkg_t *) or (pmsyncpkg_t *) */
|
alpm_list_t *packages; /* list of (pmpkg_t *) or (pmsyncpkg_t *) */
|
||||||
alpm_list_t *skiplist; /* alpm_list_t of (char *) */
|
alpm_list_t *skip_add; /* list of (char *) */
|
||||||
|
alpm_list_t *skip_remove; /* list of (char *) */
|
||||||
alpm_trans_cb_event cb_event;
|
alpm_trans_cb_event cb_event;
|
||||||
alpm_trans_cb_conv cb_conv;
|
alpm_trans_cb_conv cb_conv;
|
||||||
alpm_trans_cb_progress cb_progress;
|
alpm_trans_cb_progress cb_progress;
|
||||||
|
|
|
@ -152,49 +152,55 @@ void dump_pkg_backups(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
const char *root = alpm_option_get_root();
|
const char *root = alpm_option_get_root();
|
||||||
printf(_("Backup Files :\n"));
|
printf(_("Backup Files:\n"));
|
||||||
for(i = alpm_pkg_get_backup(pkg); i; i = alpm_list_next(i)) {
|
if(alpm_pkg_get_backup(pkg)) {
|
||||||
struct stat buf;
|
/* package has backup files, so print them */
|
||||||
char path[PATH_MAX];
|
for(i = alpm_pkg_get_backup(pkg); i; i = alpm_list_next(i)) {
|
||||||
char *str = strdup(alpm_list_getdata(i));
|
struct stat buf;
|
||||||
char *ptr = index(str, '\t');
|
char path[PATH_MAX];
|
||||||
if(ptr == NULL) {
|
char *str = strdup(alpm_list_getdata(i));
|
||||||
FREE(str);
|
char *ptr = index(str, '\t');
|
||||||
continue;
|
if(ptr == NULL) {
|
||||||
}
|
|
||||||
*ptr = '\0';
|
|
||||||
ptr++;
|
|
||||||
snprintf(path, PATH_MAX-1, "%s%s", root, str);
|
|
||||||
/* if we find the file, calculate checksums, otherwise it is missing */
|
|
||||||
if(!stat(path, &buf)) {
|
|
||||||
char *sum;
|
|
||||||
char *md5sum = alpm_get_md5sum(path);
|
|
||||||
char *sha1sum = alpm_get_sha1sum(path);
|
|
||||||
|
|
||||||
if(md5sum == NULL || sha1sum == NULL) {
|
|
||||||
ERR(NL, _("error calculating checksums for %s\n"), path);
|
|
||||||
FREE(str);
|
FREE(str);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* TODO Is this a good way to check type of backup stored?
|
*ptr = '\0';
|
||||||
* We aren't storing it anywhere in the database. */
|
ptr++;
|
||||||
if (strlen(ptr) == 32) {
|
snprintf(path, PATH_MAX-1, "%s%s", root, str);
|
||||||
sum = md5sum;
|
/* if we find the file, calculate checksums, otherwise it is missing */
|
||||||
} else { /*if (strlen(ptr) == 40) */
|
if(!stat(path, &buf)) {
|
||||||
sum = sha1sum;
|
char *sum;
|
||||||
}
|
char *md5sum = alpm_get_md5sum(path);
|
||||||
/* if checksums don't match, file has been modified */
|
char *sha1sum = alpm_get_sha1sum(path);
|
||||||
if (strcmp(sum, ptr)) {
|
|
||||||
printf(_("MODIFIED\t%s\n"), path);
|
if(md5sum == NULL || sha1sum == NULL) {
|
||||||
|
ERR(NL, _("error calculating checksums for %s\n"), path);
|
||||||
|
FREE(str);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* TODO Is this a good way to check type of backup stored?
|
||||||
|
* We aren't storing it anywhere in the database. */
|
||||||
|
if (strlen(ptr) == 32) {
|
||||||
|
sum = md5sum;
|
||||||
|
} else { /*if (strlen(ptr) == 40) */
|
||||||
|
sum = sha1sum;
|
||||||
|
}
|
||||||
|
/* if checksums don't match, file has been modified */
|
||||||
|
if (strcmp(sum, ptr)) {
|
||||||
|
printf(_("MODIFIED\t%s\n"), path);
|
||||||
|
} else {
|
||||||
|
printf(_("Not Modified\t%s\n"), path);
|
||||||
|
}
|
||||||
|
FREE(md5sum);
|
||||||
|
FREE(sha1sum);
|
||||||
} else {
|
} else {
|
||||||
printf(_("Not Modified\t%s\n"), path);
|
printf(_("MISSING\t\t%s\n"), path);
|
||||||
}
|
}
|
||||||
FREE(md5sum);
|
FREE(str);
|
||||||
FREE(sha1sum);
|
|
||||||
} else {
|
|
||||||
printf(_("MISSING\t\t%s\n"), path);
|
|
||||||
}
|
}
|
||||||
FREE(str);
|
} else {
|
||||||
|
/* package had no backup files */
|
||||||
|
printf(_("(none)\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue