Trim trailing slashes of plug-in paths

This commit is contained in:
Asanka C. Herath
2010-09-27 21:40:04 -04:00
parent f159cef78a
commit 03694f3505

View File

@@ -201,6 +201,21 @@ is_valid_plugin_filename(const char * n)
return 1;
}
static void
trim_trailing_slash(char * path)
{
size_t l;
l = strlen(path);
while (l > 0 && (path[l - 1] == '/'
#ifdef BACKSLASH_PATH_DELIM
|| path[l - 1] == '\\'
#endif
)) {
path[--l] = '\0';
}
}
static krb5_error_code
load_plugins(krb5_context context)
{
@@ -230,6 +245,8 @@ load_plugins(krb5_context context)
goto next_dir;
#endif
trim_trailing_slash(dir);
d = opendir(dir);
if (d == NULL)