update: make the package changes file read-only
This commit is contained in:
@ -20,7 +20,15 @@ bool lm_database_changes_update(lm_database_t *db, lm_pkg_t *pkg, char *file){
|
||||
char changes_path[strlen(db->dir)+sizeof(changes_file)];
|
||||
join(changes_path, db->dir, changes_file);
|
||||
|
||||
return copy_file(changes_path, file);
|
||||
if(!copy_file(changes_path, file))
|
||||
return false;
|
||||
|
||||
if(chmod(changes_path, 0444) < 0){
|
||||
lm_error_set(LM_ERR_DbChangesChmodFail);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lm_database_changes_del(lm_database_t *db, lm_pkg_t *pkg){
|
||||
@ -51,6 +59,7 @@ char *lm_database_changes_get(lm_database_t *db, lm_pkg_t *pkg){
|
||||
join(changes_path, db->dir, changes_file);
|
||||
|
||||
if(!exists(changes_path)){
|
||||
lm_error_set(LM_ERR_DbChangesNotExists);
|
||||
free(changes_path);
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user