Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
20161434
...
201614344012a58d96a9564308b0201351b8b36f
authored
2005-08-11 07:31:17 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(get_pathname): Make sure no extra slash is inserted.
1 parent
112667db
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
mailbox/mbox/folder.c
mailbox/mbox/folder.c
View file @
2016143
...
...
@@ -446,10 +446,17 @@ get_pathname (const char *dirname, const char *basename)
/* Relative. */
else
{
size_t
len
=
strlen
(
basename
);
pathname
=
calloc
(
strlen
(
dirname
)
+
len
+
2
,
sizeof
(
char
));
size_t
baselen
=
strlen
(
basename
);
size_t
dirlen
=
strlen
(
dirname
);
while
(
dirlen
>
0
&&
dirname
[
dirlen
-
1
]
==
'/'
)
dirlen
--
;
pathname
=
calloc
(
dirname
+
baselen
+
2
,
sizeof
(
char
));
if
(
pathname
)
sprintf
(
pathname
,
"%s/%s"
,
dirname
,
basename
);
{
memcpy
(
pathname
,
dirname
,
dirlen
);
pathname
[
dirlen
]
=
'/'
;
strcpy
(
pathname
+
dirlen
+
1
,
basename
);
}
}
return
pathname
;
}
...
...
Please
register
or
sign in
to post a comment