summaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'helpers')
-rw-r--r--helpers/mode.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/helpers/mode.c b/helpers/mode.c
index cec000b..b643a60 100644
--- a/helpers/mode.c
+++ b/helpers/mode.c
@@ -25,7 +25,7 @@
static const mode_t OPKG_OPK_HELPER_MODE_U_ = 04700;
static const mode_t OPKG_OPK_HELPER_MODE_G_ = 02070;
static const mode_t OPKG_OPK_HELPER_MODE_O_ = 00007;
-static const mode_t OPKG_OPK_HELPER_MODE_A_ = 00777;
+static const mode_t OPKG_OPK_HELPER_MODE_A_ = 01777;
struct _opkg_opk_helper_mode {
mode_t umask;
@@ -60,27 +60,43 @@ _opkg_opk_helper_mode_parse_perm(struct _opkg_opk_helper_mode *mode)
{
switch (*mode->sym_mode) {
case 'r':
+ if (mode->who == 0000) {
+ mode->who = OPKG_OPK_HELPER_MODE_A_^mode->umask;
+ }
_opkg_opk_helper_mode_chmod(mode, 00444);
break;
case 'w':
+ if (mode->who == 0000) {
+ mode->who = OPKG_OPK_HELPER_MODE_A_^mode->umask;
+ }
_opkg_opk_helper_mode_chmod(mode, 00222);
break;
case 'x':
+ if (mode->who == 0000) {
+ mode->who = OPKG_OPK_HELPER_MODE_A_^mode->umask;
+ }
_opkg_opk_helper_mode_chmod(mode, 00111);
break;
case 'X':
+ if (mode->who == 0000) {
+ mode->who = OPKG_OPK_HELPER_MODE_A_^mode->umask;
+ }
if (S_ISDIR(mode->cur_mode)
|| mode->cur_mode & 00111) {
_opkg_opk_helper_mode_chmod(mode, 00111);
}
break;
case 's':
+ if (mode->who == 0000) {
+ mode->who = OPKG_OPK_HELPER_MODE_A_^mode->umask;
+ }
_opkg_opk_helper_mode_chmod(mode, 06000);
break;
case 't':
- if (S_ISDIR(mode->cur_mode)
- && (mode->who & OPKG_OPK_HELPER_MODE_A_)
- == OPKG_OPK_HELPER_MODE_A_) {
+ if (S_ISDIR(mode->cur_mode) && (mode->who ==
+ OPKG_OPK_HELPER_MODE_A_ ||
+ mode->who == 0000)) {
+ mode->who = OPKG_OPK_HELPER_MODE_A_;
_opkg_opk_helper_mode_chmod(mode, 01000);
}
break;
@@ -120,9 +136,6 @@ _opkg_opk_helper_mode_parse_op(struct _opkg_opk_helper_mode *mode)
default:
return OPKG_OPK_ERROR;
}
- if (mode->who == 0000) {
- mode->who = OPKG_OPK_HELPER_MODE_A_ ^ mode->umask;
- }
++mode->sym_mode;
return OPKG_OPK_OK;
}
@@ -151,6 +164,9 @@ _opkg_opk_helper_mode_parse_permcopy(struct _opkg_opk_helper_mode *mode)
default:
return OPKG_OPK_ERROR;
}
+ if (mode->who == 0000) {
+ mode->who = OPKG_OPK_HELPER_MODE_A_ ^ mode->umask;
+ }
_opkg_opk_helper_mode_chmod(mode, perm);
++mode->sym_mode;
return OPKG_OPK_OK;