summaryrefslogtreecommitdiffstats
path: root/src/pacman/util.c
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2009-05-16 17:59:45 +0200
committerDan McGee <dan@archlinux.org>2009-06-02 05:01:04 +0200
commitf4ecc908eccc3ace2e40b15be837e4fa44ecf0a0 (patch)
treece82bf945d8dd4a3105890ad3773f7fcd3ab875c /src/pacman/util.c
parentc520d3845113ce4dc1a473c012288da7f2a655b8 (diff)
downloadpacman-f4ecc908eccc3ace2e40b15be837e4fa44ecf0a0.tar.gz
pacman-f4ecc908eccc3ace2e40b15be837e4fa44ecf0a0.tar.xz
We don't need root with -Sp
FS#8905 is fixed. The front-end passes PM_TRANS_FLAG_NOLOCK to the back-end, so it doesn't lock the database. That's why we don't need root anymore. I reworked (and renamed) needs_transaction() accordingly. I also added missing -Sc check there (for example, -Sci didn't print non-root error, but pacman wanted to lock the database). Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r--src/pacman/util.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index a2802527..8056fbd9 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -69,19 +69,16 @@ int trans_release(void)
return(0);
}
-int needs_transaction(void)
+int needs_root(void)
{
- if(config->op != PM_OP_MAIN && config->op != PM_OP_QUERY && config->op != PM_OP_DEPTEST) {
- if((config->op == PM_OP_SYNC && !config->op_s_sync &&
- (config->op_s_search || config->group || config->op_q_list || config->op_q_info))
- || config->op == PM_OP_DEPTEST) {
- /* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */
- return(0);
- } else {
- return(1);
- }
+ if(config->op == PM_OP_UPGRADE || config->op == PM_OP_REMOVE || /* -U, -R */
+ (config->op == PM_OP_SYNC && (config->op_s_clean || config->op_s_sync || /* -Sc, -Sy */
+ (!config->group && !config->op_s_info && !config->op_q_list /* all other -S combinations, where */
+ && !config->op_s_search && !config->op_s_printuris)))) { /* -g, -i, -l, -s, -p is not set */
+ return(1);
+ } else {
+ return(0);
}
- return(0);
}
/* gets the current screen column width */