400-simplify_kernel_checks.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. --- a/pppd/sys-linux.c
  2. +++ b/pppd/sys-linux.c
  3. @@ -203,7 +203,7 @@ static int driver_is_old = 0;
  4. static int restore_term = 0; /* 1 => we've munged the terminal */
  5. static struct termios inittermios; /* Initial TTY termios */
  6. -int new_style_driver = 0;
  7. +static const int new_style_driver = 1;
  8. static char loop_name[20];
  9. static unsigned char inbuf[512]; /* buffer for chars read from loopback */
  10. @@ -220,8 +220,8 @@ static int looped; /* 1 if using loop
  11. static int link_mtu; /* mtu for the link (not bundle) */
  12. static struct utsname utsname; /* for the kernel version */
  13. -static int kernel_version;
  14. #define KVERSION(j,n,p) ((j)*1000000 + (n)*1000 + (p))
  15. +static const int kernel_version = KVERSION(2,6,37);
  16. #define MAX_IFS 100
  17. @@ -1414,11 +1414,12 @@ int ccp_fatal_error (int unit)
  18. *
  19. * path_to_procfs - find the path to the proc file system mount point
  20. */
  21. -static char proc_path[MAXPATHLEN];
  22. -static int proc_path_len;
  23. +static char proc_path[MAXPATHLEN] = "/proc";
  24. +static int proc_path_len = 5;
  25. static char *path_to_procfs(const char *tail)
  26. {
  27. +#if 0
  28. struct mntent *mntent;
  29. FILE *fp;
  30. @@ -1440,6 +1441,7 @@ static char *path_to_procfs(const char *
  31. fclose (fp);
  32. }
  33. }
  34. +#endif
  35. strlcpy(proc_path + proc_path_len, tail,
  36. sizeof(proc_path) - proc_path_len);
  37. @@ -2098,11 +2100,13 @@ int ppp_available(void)
  38. "ppp.o exists in /lib/modules/`uname -r`/net.\n"
  39. "See README.linux file in the ppp distribution for more details.\n";
  40. +#if 0
  41. /* get the kernel version now, since we are called before sys_init */
  42. uname(&utsname);
  43. osmaj = osmin = ospatch = 0;
  44. sscanf(utsname.release, "%d.%d.%d", &osmaj, &osmin, &ospatch);
  45. kernel_version = KVERSION(osmaj, osmin, ospatch);
  46. +#endif
  47. fd = open("/dev/ppp", O_RDWR);
  48. #if 0
  49. @@ -2121,7 +2125,9 @@ int ppp_available(void)
  50. }
  51. #endif /* 0 */
  52. if (fd >= 0) {
  53. +#if 0
  54. new_style_driver = 1;
  55. +#endif
  56. /* XXX should get from driver */
  57. driver_version = 2;
  58. @@ -2168,6 +2174,7 @@ int ppp_available(void)
  59. if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP))
  60. ok = 0;
  61. + return ok;
  62. /*
  63. * This is the PPP device. Validate the version of the driver at this
  64. @@ -2659,6 +2666,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
  65. }
  66. #endif /* TIOCGPTN */
  67. +#if 0
  68. if (sfd < 0) {
  69. /* the old way - scan through the pty name space */
  70. for (i = 0; i < 64; ++i) {
  71. @@ -2677,6 +2685,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
  72. }
  73. }
  74. }
  75. +#endif
  76. if (sfd < 0)
  77. return 0;