Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
ee1c00fe
Commit
ee1c00fe
authored
Sep 12, 2009
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass "new_mode" to set_acl() and change its return values.
parent
1b502f3e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
24 deletions
+25
-24
acls.c
acls.c
+19
-20
generator.c
generator.c
+2
-2
rsync.c
rsync.c
+4
-2
No files found.
acls.c
View file @
ee1c00fe
...
@@ -984,17 +984,17 @@ static int set_rsync_acl(const char *fname, acl_duo *duo_item,
...
@@ -984,17 +984,17 @@ static int set_rsync_acl(const char *fname, acl_duo *duo_item,
return
0
;
return
0
;
}
}
/* Set ACL on indicated filename.
/* Given a fname, this sets extended access ACL entries, the default ACL (for a
* dir), and the regular mode bits on the file. Call this with fname set to
* NULL to just check if the ACL is different.
*
*
* This sets extended access ACL entries and default ACL. If convenient,
* If the ACL operation has a side-effect of changing the file's mode, the
* it sets permission bits along with the access ACL and signals having
* sxp->st.st_mode value will be changed to match.
* done so by modifying sxp->st.st_mode.
*
*
* Returns 1 for unchanged, 0 for changed, -1 for failed. Call this
* Returns 0 for an unchanged ACL, 1 for changed, -1 for failed. */
* with fname set to NULL to just check if the ACL is unchanged. */
int
set_acl
(
const
char
*
fname
,
const
struct
file_struct
*
file
,
stat_x
*
sxp
,
mode_t
new_mode
)
int
set_acl
(
const
char
*
fname
,
const
struct
file_struct
*
file
,
stat_x
*
sxp
)
{
{
int
unchanged
=
1
;
int
changed
=
0
;
int32
ndx
;
int32
ndx
;
BOOL
eq
;
BOOL
eq
;
...
@@ -1008,18 +1008,18 @@ int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp)
...
@@ -1008,18 +1008,18 @@ int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp)
acl_duo
*
duo_item
=
access_acl_list
.
items
;
acl_duo
*
duo_item
=
access_acl_list
.
items
;
duo_item
+=
ndx
;
duo_item
+=
ndx
;
eq
=
sxp
->
acc_acl
eq
=
sxp
->
acc_acl
&&
rsync_acl_equal_enough
(
sxp
->
acc_acl
,
&
duo_item
->
racl
,
file
->
mode
);
&&
rsync_acl_equal_enough
(
sxp
->
acc_acl
,
&
duo_item
->
racl
,
new_
mode
);
if
(
!
eq
)
{
if
(
!
eq
)
{
unchanged
=
0
;
changed
=
1
;
if
(
!
dry_run
&&
fname
if
(
!
dry_run
&&
fname
&&
set_rsync_acl
(
fname
,
duo_item
,
SMB_ACL_TYPE_ACCESS
,
&&
set_rsync_acl
(
fname
,
duo_item
,
SMB_ACL_TYPE_ACCESS
,
sxp
,
file
->
mode
)
<
0
)
sxp
,
new_
mode
)
<
0
)
unchanged
=
-
1
;
return
-
1
;
}
}
}
}
if
(
!
S_ISDIR
(
sxp
->
st
.
st
_mode
))
if
(
!
S_ISDIR
(
new
_mode
))
return
un
changed
;
return
changed
;
ndx
=
F_DIR_DEFACL
(
file
);
ndx
=
F_DIR_DEFACL
(
file
);
if
(
ndx
>=
0
&&
(
size_t
)
ndx
<
default_acl_list
.
count
)
{
if
(
ndx
>=
0
&&
(
size_t
)
ndx
<
default_acl_list
.
count
)
{
...
@@ -1027,16 +1027,15 @@ int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp)
...
@@ -1027,16 +1027,15 @@ int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp)
duo_item
+=
ndx
;
duo_item
+=
ndx
;
eq
=
sxp
->
def_acl
&&
rsync_acl_equal
(
sxp
->
def_acl
,
&
duo_item
->
racl
);
eq
=
sxp
->
def_acl
&&
rsync_acl_equal
(
sxp
->
def_acl
,
&
duo_item
->
racl
);
if
(
!
eq
)
{
if
(
!
eq
)
{
if
(
unchanged
>
0
)
changed
=
1
;
unchanged
=
0
;
if
(
!
dry_run
&&
fname
if
(
!
dry_run
&&
fname
&&
set_rsync_acl
(
fname
,
duo_item
,
SMB_ACL_TYPE_DEFAULT
,
&&
set_rsync_acl
(
fname
,
duo_item
,
SMB_ACL_TYPE_DEFAULT
,
sxp
,
file
->
mode
)
<
0
)
sxp
,
new_
mode
)
<
0
)
unchanged
=
-
1
;
return
-
1
;
}
}
}
}
return
un
changed
;
return
changed
;
}
}
/* Non-incremental recursion needs to convert all the received IDs.
/* Non-incremental recursion needs to convert all the received IDs.
...
...
generator.c
View file @
ee1c00fe
...
@@ -417,7 +417,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
...
@@ -417,7 +417,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
if
(
preserve_acls
&&
!
S_ISLNK
(
file
->
mode
))
{
if
(
preserve_acls
&&
!
S_ISLNK
(
file
->
mode
))
{
if
(
!
ACL_READY
(
*
sxp
))
if
(
!
ACL_READY
(
*
sxp
))
get_acl
(
fname
,
sxp
);
get_acl
(
fname
,
sxp
);
if
(
set_acl
(
NULL
,
file
,
sxp
)
==
0
)
if
(
set_acl
(
NULL
,
file
,
sxp
,
file
->
mode
)
)
return
0
;
return
0
;
}
}
#endif
#endif
...
@@ -476,7 +476,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
...
@@ -476,7 +476,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
if
(
preserve_acls
&&
!
S_ISLNK
(
file
->
mode
))
{
if
(
preserve_acls
&&
!
S_ISLNK
(
file
->
mode
))
{
if
(
!
ACL_READY
(
*
sxp
))
if
(
!
ACL_READY
(
*
sxp
))
get_acl
(
fnamecmp
,
sxp
);
get_acl
(
fnamecmp
,
sxp
);
if
(
set_acl
(
NULL
,
file
,
sxp
)
==
0
)
if
(
set_acl
(
NULL
,
file
,
sxp
,
file
->
mode
)
)
iflags
|=
ITEM_REPORT_ACL
;
iflags
|=
ITEM_REPORT_ACL
;
}
}
#endif
#endif
...
...
rsync.c
View file @
ee1c00fe
...
@@ -497,8 +497,10 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
...
@@ -497,8 +497,10 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
* If set_acl() changes permission bits in the process of setting
* If set_acl() changes permission bits in the process of setting
* an access ACL, it changes sxp->st.st_mode so we know whether we
* an access ACL, it changes sxp->st.st_mode so we know whether we
* need to chmod(). */
* need to chmod(). */
if
(
preserve_acls
&&
!
S_ISLNK
(
new_mode
)
&&
set_acl
(
fname
,
file
,
sxp
)
==
0
)
if
(
preserve_acls
&&
!
S_ISLNK
(
new_mode
))
{
if
(
set_acl
(
fname
,
file
,
sxp
,
new_mode
)
>
0
)
updated
=
1
;
updated
=
1
;
}
#endif
#endif
#ifdef HAVE_CHMOD
#ifdef HAVE_CHMOD
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment