| 2262 | |
| 2263 | |
| 2264 | static int fix_paths(void) |
| 2265 | { |
| 2266 | char buff[FN_REFLEN],*pos; |
| 2267 | convert_dirname(mysql_home,mysql_home,NullS); |
| 2268 | /* Resolve symlinks to allow 'mysql_home' to be a relative symlink */ |
| 2269 | my_realpath(mysql_home,mysql_home,MYF(0)); |
| 2270 | /* Ensure that mysql_home ends in FN_LIBCHAR */ |
| 2271 | pos=strend(mysql_home); |
| 2272 | if (pos[-1] != FN_LIBCHAR) |
| 2273 | { |
| 2274 | pos[0]= FN_LIBCHAR; |
| 2275 | pos[1]= 0; |
| 2276 | } |
| 2277 | convert_dirname(lc_messages_dir, lc_messages_dir, NullS); |
| 2278 | convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS); |
| 2279 | (void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir |
| 2280 | (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home); |
| 2281 | (void) my_load_path(pidfile_name, pidfile_name_ptr, mysql_real_data_home); |
| 2282 | |
| 2283 | my_realpath(mysql_unpacked_real_data_home, mysql_real_data_home, MYF(0)); |
| 2284 | mysql_unpacked_real_data_home_len= |
| 2285 | (int) strlen(mysql_unpacked_real_data_home); |
| 2286 | if (mysql_unpacked_real_data_home[mysql_unpacked_real_data_home_len-1] == FN_LIBCHAR) |
| 2287 | --mysql_unpacked_real_data_home_len; |
| 2288 | |
| 2289 | char *sharedir=get_relative_path(SHAREDIR); |
| 2290 | if (test_if_hard_path(sharedir)) |
| 2291 | strmake(buff,sharedir,sizeof(buff)-1); /* purecov: tested */ |
| 2292 | else |
| 2293 | strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS); |
| 2294 | convert_dirname(buff,buff,NullS); |
| 2295 | (void) my_load_path(lc_messages_dir, lc_messages_dir, buff); |
| 2296 | |
| 2297 | /* If --character-sets-dir isn't given, use shared library dir */ |
| 2298 | if (charsets_dir) |
| 2299 | strmake(mysql_charsets_dir, charsets_dir, sizeof(mysql_charsets_dir)-1); |
| 2300 | else |
| 2301 | strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff, |
| 2302 | CHARSET_DIR, NullS); |
| 2303 | (void) my_load_path(mysql_charsets_dir, mysql_charsets_dir, buff); |
| 2304 | convert_dirname(mysql_charsets_dir, mysql_charsets_dir, NullS); |
| 2305 | charsets_dir=mysql_charsets_dir; |
| 2306 | |
| 2307 | if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) |
| 2308 | return 1; |
| 2309 | if (!opt_mysql_tmpdir) |
| 2310 | opt_mysql_tmpdir= mysql_tmpdir; |
| 2311 | /* |
| 2312 | Convert the secure-file-priv option to system format, allowing |
| 2313 | a quick strcmp to check if read or write is in an allowed dir |
| 2314 | */ |
| 2315 | if (opt_secure_file_priv && !opt_secure_file_priv_noarg) |
| 2316 | { |
| 2317 | if (*opt_secure_file_priv == 0) |
| 2318 | opt_secure_file_priv= NULL; |
| 2319 | else |
| 2320 | { |
| 2321 | if (strlen(opt_secure_file_priv) >= FN_REFLEN) |
no test coverage detected