@@ -150,10 +150,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
150
150
There are rare cases where service config does not have
151
151
--defaults-filein the binary parth . There services were registered with
152
152
plain mysqld --install, the data directory is next to "bin" in this case.
153
- Service name (second parameter) must be MySQL.
154
153
*/
155
- if (wcscmp (args [1 ], L"MySQL" ) != 0 )
156
- goto end ;
157
154
have_inifile = FALSE;
158
155
}
159
156
else if (numargs == 3 )
@@ -211,7 +208,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
211
208
}
212
209
}
213
210
214
- if (!have_inifile )
211
+ if (!have_inifile || props -> datadir [ 0 ] == 0 )
215
212
{
216
213
/*
217
214
Hard, although a rare case, we're guessing datadir and defaults-file.
@@ -235,22 +232,25 @@ int get_mysql_service_properties(const wchar_t *bin_path,
235
232
* p = 0 ;
236
233
}
237
234
238
- /* Look for my.ini, my.cnf in the install root */
239
- sprintf_s (props -> inifile , MAX_PATH , "%s\\my.ini" , install_root );
240
- if (GetFileAttributes (props -> inifile ) == INVALID_FILE_ATTRIBUTES )
241
- {
242
- sprintf_s (props -> inifile , MAX_PATH , "%s\\my.cnf" , install_root );
243
- }
244
- if (GetFileAttributes (props -> inifile ) != INVALID_FILE_ATTRIBUTES )
245
- {
246
- /* Ini file found, get datadir from there */
247
- GetPrivateProfileString ("mysqld" , "datadir" , NULL , props -> datadir ,
248
- MAX_PATH , props -> inifile );
249
- }
250
- else
235
+ if (!have_inifile )
251
236
{
252
- /* No ini file */
253
- props -> inifile [0 ]= 0 ;
237
+ /* Look for my.ini, my.cnf in the install root */
238
+ sprintf_s (props -> inifile , MAX_PATH , "%s\\my.ini" , install_root );
239
+ if (GetFileAttributes (props -> inifile ) == INVALID_FILE_ATTRIBUTES )
240
+ {
241
+ sprintf_s (props -> inifile , MAX_PATH , "%s\\my.cnf" , install_root );
242
+ }
243
+ if (GetFileAttributes (props -> inifile ) != INVALID_FILE_ATTRIBUTES )
244
+ {
245
+ /* Ini file found, get datadir from there */
246
+ GetPrivateProfileString ("mysqld" , "datadir" , NULL , props -> datadir ,
247
+ MAX_PATH , props -> inifile );
248
+ }
249
+ else
250
+ {
251
+ /* No ini file */
252
+ props -> inifile [0 ]= 0 ;
253
+ }
254
254
}
255
255
256
256
/* Try datadir in install directory.*/
0 commit comments