@@ -37,7 +37,7 @@ inline static constexpr uint32_t SLAVE_MAX_HEARTBEAT_PERIOD=
3737inline static int change_master_id_cmp (const void *arg1, const void *arg2)
3838{
3939 const ulong &id1= *(const ulong *)arg1, &id2= *(const ulong *)arg2;
40- return (id2 > id1 ) - (id2 < id1 );
40+ return (id1 > id2 ) - (id1 < id2 );
4141}
4242
4343// / enum for @ref MasterInfoFile::master_use_gtid
@@ -357,6 +357,7 @@ struct MasterInfoFile: InfoFile
357357 bool set_default () override
358358 {
359359 mode= enum_master_use_gtid::DEFAULT;
360+ gtid_supported= true ;
360361 return false ;
361362 }
362363 /* * @return
@@ -418,12 +419,20 @@ struct MasterInfoFile: InfoFile
418419 */
419420 char buf[IntIOCache::BUF_SIZE<uint32_t > + 3 ];
420421 size_t length= my_b_gets (file, buf, sizeof (buf));
421- if (!length ||
422- std::from_chars (buf, &buf[length], seconds,
423- std::chars_format::fixed).ec != IntIOCache::ERRC_OK ||
424- seconds < 0 || seconds > SLAVE_MAX_HEARTBEAT_PERIOD)
422+ if (!length)
425423 return true ;
426- operator =(seconds / 1000 );
424+ #ifdef __clang__
425+ // FIXME: floating-point variants of `std::from_chars()` not supported
426+ char end;
427+ if (sscanf (buf, " %lf%c" , &seconds, &end) < 2 || end
428+ #else
429+ std::from_chars_result result=
430+ std::from_chars (buf, &buf[length], seconds, std::chars_format::fixed);
431+ if (result.ec != IntIOCache::ERRC_OK || *(result.ptr )
432+ #endif
433+ != ' \n ' || seconds < 0 || seconds > SLAVE_MAX_HEARTBEAT_PERIOD)
434+ return true ;
435+ operator =(static_cast <uint32_t >(seconds / 1000 ));
427436 return false ;
428437 }
429438 /* *
0 commit comments