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
e1ac7791
Commit
e1ac7791
authored
Sep 23, 2007
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed make_bak_dir() to take a const char *.
parent
5b3f6a27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
24 deletions
+23
-24
backup.c
backup.c
+23
-24
No files found.
backup.c
View file @
e1ac7791
...
...
@@ -92,32 +92,37 @@ static int make_simple_backup(const char *fname)
Create a directory given an absolute path, perms based upon another directory
path
****************************************************************************/
int
make_bak_dir
(
char
*
fullpath
)
int
make_bak_dir
(
c
onst
c
har
*
fullpath
)
{
statx
sx
;
char
fbuf
[
MAXPATHLEN
],
*
rel
,
*
end
,
*
p
;
struct
file_struct
*
file
;
char
*
rel
=
fullpath
+
backup_dir_len
;
char
*
end
=
rel
+
strlen
(
rel
);
char
*
p
=
end
;
int
len
=
backup_dir_len
;
statx
sx
;
while
(
strncmp
(
fullpath
,
"./"
,
2
)
==
0
)
while
(
*
fullpath
==
'.'
&&
fullpath
[
1
]
==
'/'
)
{
fullpath
+=
2
;
len
-=
2
;
}
if
(
strlcpy
(
fbuf
,
fullpath
,
sizeof
fbuf
)
>=
sizeof
fbuf
)
return
-
1
;
rel
=
fbuf
+
len
;
end
=
p
=
rel
+
strlen
(
rel
);
/* Try to find an existing dir, starting from the deepest dir. */
while
(
1
)
{
if
(
--
p
==
fullpath
)
{
p
+=
strlen
(
p
);
goto
failure
;
}
if
(
--
p
==
fbuf
)
return
-
1
;
if
(
*
p
==
'/'
)
{
*
p
=
'\0'
;
if
(
mkdir_defmode
(
f
ullpath
)
==
0
)
if
(
mkdir_defmode
(
f
buf
)
==
0
)
break
;
if
(
errno
!=
ENOENT
)
{
rsyserr
(
FERROR
,
errno
,
"make_bak_dir mkdir %s failed"
,
full_fname
(
f
ullpath
));
goto
failure
;
full_fname
(
f
buf
));
return
-
1
;
}
}
}
...
...
@@ -154,7 +159,7 @@ int make_bak_dir(char *fullpath)
free_xattr
(
&
sx
);
}
#endif
set_file_attrs
(
f
ullpath
,
file
,
NULL
,
NULL
,
0
);
set_file_attrs
(
f
buf
,
file
,
NULL
,
NULL
,
0
);
unmake_file
(
file
);
}
}
...
...
@@ -162,20 +167,14 @@ int make_bak_dir(char *fullpath)
p
+=
strlen
(
p
);
if
(
p
==
end
)
break
;
if
(
mkdir_defmode
(
f
ullpath
)
<
0
)
{
if
(
mkdir_defmode
(
f
buf
)
<
0
)
{
rsyserr
(
FERROR
,
errno
,
"make_bak_dir mkdir %s failed"
,
full_fname
(
f
ullpath
));
goto
failure
;
full_fname
(
f
buf
));
return
-
1
;
}
}
return
0
;
failure:
while
(
p
!=
end
)
{
*
p
=
'/'
;
p
+=
strlen
(
p
);
}
return
-
1
;
return
0
;
}
/* robustly move a file, creating new directory structures if necessary */
...
...
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