|
Lines 17-22
Link Here
|
| 17 |
*/ |
17 |
*/ |
| 18 |
|
18 |
|
| 19 |
#include <config.h> |
19 |
#include <config.h> |
|
|
20 |
#include <limits.h> |
| 20 |
#include <stdlib.h> |
21 |
#include <stdlib.h> |
| 21 |
#include <string.h> |
22 |
#include <string.h> |
| 22 |
#include <stddef.h> |
23 |
#include <stddef.h> |
|
Lines 160-166
Link Here
|
| 160 |
else /* link the directory */ |
161 |
else /* link the directory */ |
| 161 |
{ |
162 |
{ |
| 162 |
char *target_locale; |
163 |
char *target_locale; |
| 163 |
char aux_path[PATHLEN]; |
164 |
int path_max = 4096; |
|
|
165 |
char *aux_path; |
| 166 |
#ifdef PATH_MAX |
| 167 |
path_max = PATH_MAX; |
| 168 |
#else |
| 169 |
path_max = pathconf (source_path, _PC_PATH_MAX); |
| 170 |
if (path_max <= 0) path_max = 4096; |
| 171 |
#endif |
| 172 |
|
| 173 |
aux_path = (char *)malloc(path_max); |
| 174 |
if (!aux_path) { |
| 175 |
printf ("No enough memory!\n"); |
| 176 |
return 2; |
| 177 |
} |
| 164 |
|
178 |
|
| 165 |
realpath(source_path, aux_path); |
179 |
realpath(source_path, aux_path); |
| 166 |
target_locale = strrchr(aux_path, '/'); |
180 |
target_locale = strrchr(aux_path, '/'); |
|
Lines 170-175
Link Here
|
| 170 |
snprintf(target_path, PATHLEN, "%s", target_locale); |
184 |
snprintf(target_path, PATHLEN, "%s", target_locale); |
| 171 |
|
185 |
|
| 172 |
symlink(target_path, source_path); |
186 |
symlink(target_path, source_path); |
|
|
187 |
free (aux_path); |
| 173 |
} |
188 |
} |
| 174 |
} |
189 |
} |
| 175 |
|
190 |
|