diff -Naur scrollkeeper-0.3.14.orig/libs/database.c scrollkeeper-0.3.14/libs/database.c --- scrollkeeper-0.3.14.orig/libs/database.c 2002-06-02 10:03:10 +0400 +++ scrollkeeper-0.3.14/libs/database.c 2007-06-25 16:38:14 +0400 @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -160,7 +161,20 @@ else /* link the directory */ { char *target_locale; - char aux_path[PATHLEN]; + int path_max = 4096; + char *aux_path; +#ifdef PATH_MAX + path_max = PATH_MAX; +#else + path_max = pathconf (source_path, _PC_PATH_MAX); + if (path_max <= 0) path_max = 4096; +#endif + + aux_path = (char *)malloc(path_max); + if (!aux_path) { + printf ("No enough memory!\n"); + return 2; + } realpath(source_path, aux_path); target_locale = strrchr(aux_path, '/'); @@ -170,6 +184,7 @@ snprintf(target_path, PATHLEN, "%s", target_locale); symlink(target_path, source_path); + free (aux_path); } }