summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/mf_pack.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index c18d37888b8..b442af7e9e5 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -236,11 +236,16 @@ void symdirget(char *dir)
*pos++=temp; *pos=0; /* Restore old filename */
if (fp)
{
- if (fgets(buff, sizeof(buff), fp))
+ if (fgets(buff, sizeof(buff)-1, fp))
{
for (pos=strend(buff);
pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
pos --);
+
+ /* Ensure that the symlink ends with the directory symbol */
+ if (pos == buff || pos[-1] != FN_LIBCHAR)
+ *pos++=FN_LIBCHAR;
+
strmake(dir,buff, (uint) (pos-buff));
}
my_fclose(fp,MYF(0));