33 lines
762 B
Diff
33 lines
762 B
Diff
|
--- a/libdm/ioctl/libdm-iface.c
|
||
|
+++ b/libdm/ioctl/libdm-iface.c
|
||
|
@@ -152,6 +152,7 @@ static int _uname(void)
|
||
|
{
|
||
|
static int _uts_set = 0;
|
||
|
struct utsname _uts;
|
||
|
+ int parts;
|
||
|
|
||
|
if (_uts_set)
|
||
|
return 1;
|
||
|
@@ -160,10 +161,18 @@ static int _uname(void)
|
||
|
log_error("uname failed: %s", strerror(errno));
|
||
|
return 0;
|
||
|
}
|
||
|
- if (sscanf(_uts.release, "%d.%d.%d",
|
||
|
+
|
||
|
+ parts = sscanf(_uts.release, "%d.%d.%d",
|
||
|
&_kernel_major,
|
||
|
&_kernel_minor,
|
||
|
- &_kernel_release) != 3) {
|
||
|
+ &_kernel_release);
|
||
|
+
|
||
|
+ if (parts == 1 && _kernel_major >= 3) {
|
||
|
+ _kernel_minor = 0;
|
||
|
+ _kernel_release = 0;
|
||
|
+ } else if (parts == 2 && _kernel_major >= 3) {
|
||
|
+ _kernel_release = 0;
|
||
|
+ } else if (parts != 3) {
|
||
|
log_error("Could not determine kernel version used.");
|
||
|
return 0;
|
||
|
}
|
||
|
|