Compare commits
1 Commits
b48df8e801
...
25eb54b557
| Author | SHA1 | Date |
|---|---|---|
|
|
25eb54b557 |
3
HISTORY
3
HISTORY
|
|
@ -1,7 +1,4 @@
|
||||||
|
|
||||||
Version 1.86 2026-06-25
|
|
||||||
* add function fc_parse_version
|
|
||||||
|
|
||||||
Version 1.85 2026-06-23
|
Version 1.85 2026-06-23
|
||||||
* add functions fc_safe_srand and fc_safe_rand for more security under Linux
|
* add functions fc_safe_srand and fc_safe_rand for more security under Linux
|
||||||
* add function seconds_to_human_str
|
* add function seconds_to_human_str
|
||||||
|
|
|
||||||
|
|
@ -4691,27 +4691,3 @@ int fc_safe_rand()
|
||||||
return (n & RAND_MAX);
|
return (n & RAND_MAX);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int fc_parse_version(const char *src, Version *version)
|
|
||||||
{
|
|
||||||
const char *p;
|
|
||||||
int numbers[2];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
numbers[0] = numbers[1] = 0;
|
|
||||||
p = src;
|
|
||||||
for (i=0; i<2; i++) {
|
|
||||||
p = strchr(p, '.');
|
|
||||||
if (p == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
p++;
|
|
||||||
numbers[i] = strtol(p, NULL, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
version->major = strtol(src, NULL, 10);
|
|
||||||
version->minor = numbers[0];
|
|
||||||
version->patch = numbers[1];
|
|
||||||
return FC_VERSION_TO_INT1(*version);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1877,8 +1877,6 @@ int fc_safe_rand();
|
||||||
#define fc_safe_rand() rand()
|
#define fc_safe_rand() rand()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int fc_parse_version(const char *src, Version *version);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -960,6 +960,9 @@ int get_sysinfo(struct fast_sysinfo *info)
|
||||||
int get_kernel_version(Version *version)
|
int get_kernel_version(Version *version)
|
||||||
{
|
{
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
|
char *p;
|
||||||
|
int numbers[2];
|
||||||
|
int i;
|
||||||
|
|
||||||
if (uname(&name) < 0)
|
if (uname(&name) < 0)
|
||||||
{
|
{
|
||||||
|
|
@ -969,7 +972,21 @@ int get_kernel_version(Version *version)
|
||||||
return errno != 0 ? errno : EFAULT;
|
return errno != 0 ? errno : EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
fc_parse_version(name.release, version);
|
numbers[0] = numbers[1] = 0;
|
||||||
|
p = name.release;
|
||||||
|
for (i=0; i<2; i++) {
|
||||||
|
p = strchr(p, '.');
|
||||||
|
if (p == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
p++;
|
||||||
|
numbers[i] = strtol(p, NULL, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
version->major = strtol(name.release, NULL, 10);
|
||||||
|
version->minor = numbers[0];
|
||||||
|
version->patch = numbers[1];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue