[PATCH] concat_dir_and_file() needs fixes

Jindrich Novy jnovy at redhat.com
Fri Dec 2 12:44:13 UTC 2005


Hello mc-devel,

1)
There's a bug in concat_dir_and_file(). If you try to reproduce the PHP
syntax highlighting problem in:

http://mail.gnome.org/archives/mc-devel/2005-December/msg00000.html

then you'll get this message in the "Load syntax file" error dialog:
Error in file /usr/share/mc//syntax/php.syntax on line 4367

Note the two slashes in the path.

2)
When looking at concat_dir_and_file() to figure out what happens in 1)
you see:

char *
concat_dir_and_file (const char *dir, const char *file)
{
    int i = strlen (dir);

    if (dir [i-1] == PATH_SEP)
        return  g_strconcat (dir, file, (char *) NULL);
    else
        return  g_strconcat (dir, PATH_SEP_STR, file, (char *) NULL);
}

what's odd -> imagine that dir="".

Patch to fix the both the bugs is attached.

Jindrich
-- 
Jindrich Novy <jnovy at redhat.com>, http://people.redhat.com/jnovy/
(o_                                                           _o)
//\      The worst evil in the world is refusal to think.     //\
V_/_                                                         _\_V

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mc-concat.patch
Type: text/x-patch
Size: 652 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20051202/49bc68ff/attachment.bin>


More information about the mc-devel mailing list