summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/chmod.c13
-rw-r--r--coreutils/chown.c9
2 files changed, 11 insertions, 11 deletions
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index 27e9b6b..d2988c4 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -65,12 +65,14 @@
* symbolic links encountered during recursive directory traversals.
*/
-static int FAST_FUNC fileAction(const char *fileName, struct stat *statbuf, void* param, int depth)
+static int FAST_FUNC fileAction(struct recursive_state *state,
+ const char *fileName,
+ struct stat *statbuf)
{
mode_t newmode;
/* match coreutils behavior */
- if (depth == 0) {
+ if (state->depth == 0) {
/* statbuf holds lstat result, but we need stat (follow link) */
if (stat(fileName, statbuf))
goto err;
@@ -79,9 +81,9 @@ static int FAST_FUNC fileAction(const char *fileName, struct stat *statbuf, void
return TRUE;
}
- newmode = bb_parse_mode((char *)param, statbuf->st_mode);
+ newmode = bb_parse_mode((char *)state->userData, statbuf->st_mode);
if (newmode == (mode_t)-1)
- bb_error_msg_and_die("invalid mode '%s'", (char *)param);
+ bb_error_msg_and_die("invalid mode '%s'", (char *)state->userData);
if (chmod(fileName, newmode) == 0) {
if (OPT_VERBOSE
@@ -136,8 +138,7 @@ int chmod_main(int argc UNUSED_PARAM, char **argv)
OPT_RECURSE, // recurse
fileAction, // file action
fileAction, // dir action
- smode, // user data
- 0) // depth
+ smode) // user data
) {
retval = EXIT_FAILURE;
}
diff --git a/coreutils/chown.c b/coreutils/chown.c
index a1c5c02..ffccc6c 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -97,10 +97,10 @@ struct param_t {
chown_fptr chown_func;
};
-static int FAST_FUNC fileAction(const char *fileName, struct stat *statbuf,
- void *vparam, int depth UNUSED_PARAM)
+static int FAST_FUNC fileAction(struct recursive_state *state UNUSED_PARAM,
+ const char *fileName, struct stat *statbuf)
{
-#define param (*(struct param_t*)vparam)
+#define param (*(struct param_t*)state->userData)
#define opt option_mask32
uid_t u = (param.ugid.uid == (uid_t)-1L) ? statbuf->st_uid : param.ugid.uid;
gid_t g = (param.ugid.gid == (gid_t)-1L) ? statbuf->st_gid : param.ugid.gid;
@@ -159,8 +159,7 @@ int chown_main(int argc UNUSED_PARAM, char **argv)
flags, /* flags */
fileAction, /* file action */
fileAction, /* dir action */
- &param, /* user data */
- 0) /* depth */
+ &param) /* user data */
) {
retval = EXIT_FAILURE;
}