summaryrefslogtreecommitdiffstats
path: root/system/nvidia-driver/nvidia-installer-removed-sysctl-h.patch
blob: 7b230fcb11d38fbed2746916f8a771ee4fde5aac (plain)
diff -Naur nvidia-installer-460.67.orig/kernel.c nvidia-installer-460.67/kernel.c
--- nvidia-installer-460.67.orig/kernel.c	2021-03-10 19:24:00.000000000 -0500
+++ nvidia-installer-460.67/kernel.c	2021-04-16 17:59:48.828574898 -0400
@@ -23,7 +23,10 @@
 #include <sys/utsname.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/sysctl.h>
+#include <gnu/libc-version.h>
+#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 30
+  #include <sys/sysctl.h>
+#endif
 #include <ctype.h>
 #include <stdlib.h>
 #include <dirent.h>
@@ -1076,7 +1079,8 @@
     }
 
     if (!loglevel_set) {
-        /*
+#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 30
+         /*
          * Explicitly initialize the value of len, even though it looks like the
          * syscall should do that, since in practice it doesn't always actually
          * set the value of the pointed-to length parameter.
@@ -1090,6 +1094,10 @@
                 loglevel_set = TRUE;
             }
         }
+#else   /* sys/sysctl.h has been removed from glibc 2.32 and later */
+        if (!old_level)
+        loglevel_set = TRUE;
+#endif
     }
 
     return loglevel_set;